CKA Workloads and Scheduling Practice Question
Which command rolls back a Deployment named 'web' to the previous revision?
⚠ Common exam trap
Candidates often confuse `rollout restart` (which restarts Pods without changing the revision) with `rollout undo` (which reverts to a previous revision), or they invent non-existent commands like `rollout revert` due to familiarity with other orchestration tools.
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
The correct command to roll back a Deployment to the previous revision is `kubectl rollout undo deployment web`. This command reverts the Deployment to the last known stable revision by decrementing the revision number in the rollout history, effectively undoing the most recent change. It is the standard Kubernetes mechanism for rollback operations on Deployments, DaemonSets, and StatefulSets.
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 restart deployment web
Why it's wrong here
This command triggers a rolling restart of the deployment's pods by updating the pod template's internal annotations, specifically the restartedAt timestamp. While it terminates existing pods and spins up new ones to refresh application state or pick up external configuration changes, it does not alter the deployment's revision history or revert to a previous state.
- ✓
kubectl rollout undo deployment web
Why this is correct
This is the correct command to roll back a deployment to its immediately preceding revision. By default, it targets the last successful revision in the deployment's history, updating the ReplicaSet controller to scale down the current active ReplicaSet and scale up the previous one.
- ✗
kubectl rollout history deployment web --revision=previous
Why it's wrong here
This command is used to inspect the configuration details of a specific revision in the deployment's history. It is a read-only diagnostic command that accepts integer revision numbers rather than the string 'previous', and it performs no state changes or rollbacks on the cluster.
- ✗
kubectl rollout revert deployment web
Why it's wrong here
This command is invalid because 'revert' is not a recognized subcommand of the kubectl rollout utility. Attempting to execute this command will result in a command-line syntax error, as Kubernetes utilizes the 'undo' subcommand specifically for rolling back deployment configurations.
Go deeper
Related to this question
Learn chapter
Installing Kubernetes with kubeadm
Key term
StatefulSets
A Kubernetes resource that manages stateful applications by providing stable network identities and persistent storage for each pod.
Key term
Ingress Resources
Ingress Resources are Kubernetes API objects that manage external access to services inside a cluster, typically HTTP and HTTPS traffic, by defining rules for routing requests based on hostnames and paths.
About these practice questions
Courseiva writes every CKA question from scratch — 726 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.