Courseiva
Application Deployment →hardMultiple Choice

CKAD Application Deployment Practice Question

You have a Deployment named 'frontend' with 3 replicas. You run 'kubectl rollout history deployment/frontend' and see revision 1 and revision 2. You want to rollback to revision 1. What command should you use?

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/frontend --to-revision=1

The 'kubectl rollout undo' command with the --to-revision flag rolls back to a specific revision. Option A is correct.

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/frontend --to-revision=1

    Why this is correct

    The command `kubectl rollout undo deployment/frontend --to-revision=1` is the correct rollback mechanism: it instructs the Deployment controller to revert the current pod template to the exact spec stored in revision 1 of its rollout history. This is the idiomatic way to undo a bad change, because it creates a new rollout (incrementing the revision number) while applying the old template, thereby preserving auditability. Using `--to-revision` explicitly targets a specific historical revision, ensuring the rollback is deterministic rather than merely undoing the most recent change.

  • ✗

    kubectl set image deployment/frontend app=nginx:1.19

    Why it's wrong here

    The command `kubectl set image deployment/frontend app=nginx:1.19` does not perform a rollback; it directly mutates the container image in the live Deployment spec to nginx:1.19, which creates a new ReplicaSet and starts a new rollout. This is a forward change, not a revert to a previous state, and it would generate a new revision (e.g., revision N+1) rather than returning to revision 1. While it could coincidentally restore an earlier image tag, it does not use the rollout history mechanism and would not restore other fields (like environment variables or command arguments) from the original revision.

  • ✗

    kubectl rollout undo deployment/frontend revision=1

    Why it's wrong here

    The command `kubectl rollout undo deployment/frontend revision=1` is syntactically invalid because the flag to specify a target revision is `--to-revision`, not a bare `revision=1` argument. The Kubernetes CLI parser would treat `revision=1` as an unexpected positional argument or an unknown flag, causing the command to fail with a syntax error before any rollback is attempted. The correct usage requires the `--to-revision` flag with a value, as in `kubectl rollout undo deployment/frontend --to-revision=1`.

  • ✗

    kubectl rollout history deployment/frontend --revision=1

    Why it's wrong here

    The command `kubectl rollout history deployment/frontend --revision=1` is an inspection command, not a rollback operation. It retrieves and displays the full details of a specific historical revision (revision 1), including the pod template, labels, and annotations, but it makes no changes to the live Deployment. To actually revert the Deployment to that revision, you must use `kubectl rollout undo` with the `--to-revision` flag, which triggers a new rollout using the historical template; merely viewing history never alters the current state.

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.