Courseiva
Application Deployment →hardMultiple Select

CKAD Application Deployment Practice Question

Which THREE of the following are valid ways to update a Deployment's container image in Kubernetes?

⚠ Common exam trap

It's easy for candidates to confuse `kubectl rollout` with `kubectl set image` or invent commands like `kubectl update` or `kubectl rollout image`, which do not exist in kubectl's command set.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

kubectl apply -f updated-deployment.yaml with the new image.

`kubectl apply -f updated-deployment.yaml` applies a declarative configuration that includes the new container image. When the Deployment manifest is updated with the new image and reapplied, Kubernetes performs a rolling update to gradually replace pods with the new image, ensuring zero downtime if configured correctly.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    kubectl apply -f updated-deployment.yaml with the new image.

    Why this is correct

    kubectl apply is a declarative command that merges the changes from the provided updated-deployment.yaml into the live Deployment object. It calculates a patch based on the difference between the new file and the existing object, then updates only the modified fields, such as the container image. This is a valid, recommended approach because the file represents the complete desired state, and apply also records the applied configuration for future three-way merges.

  • ✓

    kubectl set image deployment/myapp myapp=nginx:1.20

    Why this is correct

    kubectl set image is an imperative command that directly updates the container image for a named container in a Deployment. The syntax 'deployment/myapp myapp=nginx:1.20' specifies the Deployment name and the container-name=image pair, which triggers a rolling update. This is valid for quick, targeted image changes without editing the full manifest, and it is a core kubectl command.

  • ✗

    kubectl update deployment myapp --image=nginx:1.20

    Why it's wrong here

    kubectl update is not a recognized kubectl subcommand; the valid imperative verbs are 'set', 'edit', 'apply', 'patch', and 'replace'. This command would return an error because there is no 'update' action at the top level of the kubectl CLI. The correct way to achieve the same intent imperatively is 'kubectl set image deployment/myapp myapp=nginx:1.20'.

  • ✗

    kubectl rollout image deployment myapp nginx:1.20

    Why it's wrong here

    kubectl rollout image is not a valid command; the 'kubectl rollout' subcommands are 'status', 'history', 'undo', 'restart', 'pause', and 'resume', none of which set or modify images. Additionally, even if such a subcommand existed, the image argument would need to be specified as 'container-name=image' (e.g., 'myapp=nginx:1.20'), not just 'nginx:1.20'. This is a common confusion because 'rollout' is associated with deployment changes, but it does not accept image updates.

  • ✓

    kubectl edit deployment myapp and change the image in the editor.

    Why this is correct

    kubectl edit opens the live Deployment object in your default editor, letting you modify any field, including the container image, and then saves the changes back to the cluster. It is valid because the edit operation performs a GET followed by an update (essentially a PUT/replace), which triggers a new rollout. However, unlike 'kubectl apply', it does not update the 'last-applied-configuration' annotation, which can affect future declarative merges.

About these practice questions

This CKAD question is part of Courseiva's 826-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKAD practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKAD exam.