What does the kubectl apply command do?

  1. Deletes resources
  2. Stops running Pods
  3. Lists all resources
  4. 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

Practice Certified Kubernetes App Developer (CKAD) Questions Free