CKA Workloads and Scheduling Practice Question
You have a Deployment with 3 replicas. You run 'kubectl rollout history deployment web-app' and see revision 2 is current. You want to roll back to revision 1. Which command should you use?
⚠ Common exam trap
Many exam-takers confuse `kubectl rollout undo` (which defaults to the previous revision) with the need to specify `--to-revision` to target an arbitrary revision, or they mistakenly use `kubectl set image` to 'revert' the image, which instead creates a new revision rather than rolling back.
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 rollout undo deployment/web-app --to-revision=1
`kubectl rollout undo deployment/web-app --to-revision=1` explicitly rolls back the Deployment to revision 1, which is the desired state. The `--to-revision` flag targets a specific revision from the rollout history, ensuring the Deployment's Pod template is reverted to the exact configuration of revision 1.
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 set image deployment/web-app web-app=image:v1
Why it's wrong here
While this command updates the container image of the deployment to `image:v1`, it creates a brand new rollout revision rather than reverting to an existing historical revision. It does not utilize the deployment's revision history to restore previous configurations like environment variables or resource limits that might have changed.
- ✗
kubectl rollout history deployment/web-app --revision=1
Why it's wrong here
This command is used purely for inspection, displaying the detailed configuration, annotations, and pod template metadata of revision 1. It is a read-only operation that does not trigger any state changes, replica set scaling, or rollbacks within the cluster.
- ✓
kubectl rollout undo deployment/web-app --to-revision=1
Why this is correct
This command explicitly instructs the deployment controller to revert the deployment's state to the exact configuration defined in revision 1. It achieves this by scaling up the ReplicaSet associated with revision 1 while scaling down the current active ReplicaSet.
- ✗
kubectl rollout undo deployment/web-app
Why it's wrong here
Without the `--to-revision` flag, this command defaults to rolling back only to the immediately preceding revision (revision N-1). If the deployment has undergone multiple updates, this will not target revision 1 unless it happens to be the direct predecessor.
Go deeper
Related to this question
About these practice questions
One of 726 original CKA 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 CKA 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 CKA exam.