Courseiva
Workloads and SchedulingeasyMultiple ChoiceObjective-mapped

CKA Workloads and Scheduling Practice Question

You have a Deployment named 'web-app' in the 'default' namespace. You run the following command: kubectl rollout history deployment web-app. The output shows: revision 1, revision 2, revision 3. You want to roll back to revision 1. Which command achieves this?

⚠ Common exam trap

It's easy for candidates to confuse the `--revision` flag (used with `kubectl rollout history`) with the `--to-revision` flag required for `kubectl rollout undo`, or they mistakenly think `kubectl rollback` is a valid command.

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` with the `--to-revision` flag is the proper syntax to roll back a Deployment to a specific revision. The command `kubectl rollout undo deployment web-app --to-revision=1` reverts the Deployment to revision 1, as shown in the rollout history output.

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 web-app --revision=1

    Why it's wrong here

    The flag `--revision` is not a valid flag for `kubectl rollout undo`; the correct parameter is `--to-revision`. Using `--revision` would cause kubectl to fail with a flag recognition error because this subcommand only accepts `--to-revision` to specify the target revision. Note that `--revision` does exist for `kubectl rollout history`, where it is used to display the details of a particular revision, but it does not perform or control a rollback.

  • kubectl rollout undo deployment web-app --to-revision=1

    Why this is correct

    This is the correct command to revert the `web-app` Deployment to exactly revision 1. The `--to-revision=1` flag explicitly selects the first recorded revision from the rollout history, forcing Kubernetes to restore that revision's pod template spec. All later changes—such as image updates, environment variable modifications, or container command changes—are discarded, and the Deployment will scale down the current ReplicaSet and scale up the ReplicaSet corresponding to revision 1.

  • kubectl rollback deployment web-app --to-revision=1

    Why it's wrong here

    `kubectl rollback` is not a recognized kubectl command. The kubectl command family for returning to older configurations is `kubectl rollout`, and the specific action is `undo`, not `rollback`. Attempting to run `kubectl rollback deployment web-app --to-revision=1` will produce an error such as `unknown command "rollback"`, and no operation will happen on the cluster. Thus this option is invalid because the command itself does not exist.

  • kubectl rollout undo deployment web-app

    Why it's wrong here

    Without the `--to-revision` flag, `kubectl rollout undo` reverts to the *previous* revision, not necessarily revision 1. If the `web-app` Deployment has undergone several updates since creation, the previous revision could be revision 3, revision 4, or any later revision—it is only the immediate predecessor in rollout history. Therefore this command does not guarantee the Deployment returns to revision 1, which is the specific requirement in this scenario.

Visual reference

Client Server SYN (seq=100) SYN-ACK (seq=200, ack=101) ACK (ack=201) Connection established — data transfer begins

About these practice questions

Courseiva writes every CKA question from scratch — 302 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 →

How Courseiva writes practice questions · Editorial policy

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.