KCNA Kubernetes Fundamentals Practice Question
An administrator wants to perform a rolling update of a Deployment. Which TWO actions will achieve this?
⚠ Common exam trap
Candidates often confuse scaling (Option B) or deleting/recreating (Option C) with a rolling update, or think that 'rollout undo' (Option D) is a way to update to a new image, when it is actually for reverting to a previous version.
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
✓
Run 'kubectl set image deployment/myapp myapp=myapp:v2'
Option A is correct because 'kubectl set image deployment/myapp myapp=myapp:v2' updates the container image in the Deployment's Pod template, which triggers the Deployment controller to perform a rolling update by creating a new ReplicaSet and gradually replacing old Pods while maintaining availability. Option E is also correct because editing the Deployment YAML to change the image version and running 'kubectl apply -f deployment.yaml' updates the Pod template spec, causing the same rolling update behavior managed by the Deployment controller. Option B is incorrect because scaling to zero replicas causes downtime and does not perform a rolling update; scaling back up simply creates new Pods without the controlled surge/unavailable semantics of a rollout. Option C is incorrect because deleting and recreating the Deployment destroys the existing rollout history and causes an outage rather than a rolling update. Option D is incorrect because 'kubectl rollout undo' reverts to a previous revision, which is a rollback, not a rolling update to a new image version.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Run 'kubectl set image deployment/myapp myapp=myapp:v2'
Why this is correct
kubectl set image patches the Deployment's pod template with the new image tag, which triggers the controller to create a new ReplicaSet and roll pods over gradually. This achieves the rolling update without editing YAML manually.
- ✗
Run 'kubectl scale deployment myapp --replicas=0' then 'kubectl scale deployment myapp --replicas=5'
Why it's wrong here
Scaling to zero terminates every pod, causing full downtime, then scaling up starts the new image without any gradual replacement or readiness gating. It is tempting because scaling commands are simple, and scaling would be correct for adjusting capacity, not for rolling updates.
- ✗
Run 'kubectl delete deployment' and then 'kubectl create deployment' with the new image
Why it's wrong here
Deleting the Deployment removes all pods and its ReplicaSet history, so the recreate causes an outage and loses rollout revision tracking. It is tempting because recreating with a new image does change the running version, and this would be correct for a disposable test workload where downtime is acceptable.
- ✗
Run 'kubectl rollout undo deployment/myapp'
Why it's wrong here
Rollout undo reverts the Deployment to its previous revision, restoring the old image rather than deploying the new one. It is tempting because it manipulates rollout history, and it would be correct for rolling back a faulty release, not for performing an update.
- ✓
Edit the Deployment YAML to change the image version and run 'kubectl apply -f deployment.yaml'
Why this is correct
Changing the container image tag in the Deployment's pod template and reapplying the manifest triggers the controller to roll out new pods incrementally, replacing old replicas while maintaining availability, which is exactly the rolling update behaviour the administrator requires.
Go deeper
Related to this question
About these practice questions
One of 930 original KCNA practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This KCNA 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 KCNA exam.