What does the kubectl apply command do?
- Deletes resources
- Stops running Pods
- Lists all resources
- Creates or updates resources based on YAML ✓
Correct answer: Creates or updates resources based on YAML
Option D is correct because kubectl apply is a declarative command that reads a YAML or JSON manifest and either creates the resource if it does not exist or updates it to match the desired state defined in the file. Option A is wrong because kubectl delete is the command used to remove resources. Option B is wrong because there is no single kubectl command that stops a running Pod without deleting it; you would scale a Deployment to zero or delete the Pod. Option C is wrong because kubectl get (or kubectl list) is used to enumerate resources, not kubectl apply.
Topic: · kubectl, declarative configuration, kubernetes resources, yaml manifests