CKA Workloads and Scheduling Practice Question
You have a Deployment with spec.replicas=3. You update the container image. The rollout gets stuck because the new ReplicaSet cannot create pods due to an image pull error. Which command would you use to roll back to the previous revision?
⚠ Common exam trap
A common mix-up: candidates confuse the `undo` command with non-existent verbs like `revert` or `rollback`, or incorrectly assume `--to-revision=1` is required to go back one step, when the default behavior already targets the previous revision.
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/<name>
`kubectl rollout undo deployment/<name>` reverts the Deployment to the previous revision by default. This command uses the rollout history stored in the Deployment's annotations (specifically `deployment.kubernetes.io/revision`) to restore the prior ReplicaSet's pod template, effectively undoing the failed image update.
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 rollout undo deployment/<name>
Why this is correct
This is the standard mechanism for reverting a Deployment to the last successful revision. The undo command instructs the Deployment controller to scale the previous ReplicaSet back up and the current one down, effectively applying the prior pod template. It's the safest, most direct way to reverse an unintentional change when you've verified the previous revision is healthy.
- ✗
kubectl rollout undo deployment/<name> --to-revision=1
Why it's wrong here
Using --to-revision=1 forces a rollback to a specific historical revision, not necessarily the one immediately before the current. If the Deployment has progressed through multiple revisions, the immediate previous revision would be current-1; revision 1 might be far older, possibly skipping critical intervening configuration. This can be useful for deliberate restores, but it's not equivalent to a generic 'undo last change' command.
- ✗
kubectl rollout revert deployment/<name>
Why it's wrong here
kubectl rollout revert is not a valid kubectl subcommand. The kubectl rollout verb supports only history, status, undo, pause, resume, and restart. Typing 'revert' produces an error: unknown command 'revert' for 'kubectl rollout'. The intended functionality is covered by 'undo', which is the only rollback-related subcommand.
- ✗
kubectl rollout rollback deployment/<name>
Why it's wrong here
'rollback' is also not a recognized subcommand of kubectl rollout. Valid kubectl commands use 'undo' for this purpose, not 'rollback', which may be confused with analogous terms from other orchestration tools. Because the API object is a ReplicaSet revision rather than a Git commit, Kubernetes deliberately names the operation 'undo' to reflect shifting the Deployment back to a prior revision with a new rollout object.
Go deeper
Related to this question
Learn chapter
Kubernetes Architecture Overview
Key term
kubectl Command Reference
kubectl is the command-line tool used to interact with and manage Kubernetes clusters by sending commands to the Kubernetes API.
Key term
Network Policies
A Kubernetes resource that controls how pods communicate with each other and with other network endpoints, acting as a firewall for pod-to-pod traffic.
About these practice questions
This CKA question is part of Courseiva's 726-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 →
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.