Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 24/ 160
02. Workload Controllers & Scaling

Deployment Rollbacks, Revision History & Pausing Rollouts

Roll back bad releases, inspect revision history, and pause/resume rollouts.

IntermediateRollback · Revision History · Pause3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

A Deployment revision is a labeled conveyor blueprint; rollback changes the blueprint, not any package contents already sent downstream. The simple Kubernetes rule is: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.

Think of it like…

A Deployment revision is a labeled conveyor blueprint; rollback changes the blueprint, not any package contents already sent downstream.

Where you’ve seen it

During a release or scale event, the workload owner runs kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3. Expected evidence: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior. If the run instead shows this symptom, stop and restore the last known state: Rollback returns the workload template, not the external database, messages, or feature state that the new version may already have changed.

Words you’ll hear

Rollback
For this lesson, Rollback is the controlling idea: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.
Revision History
Revision History is the checkpoint; run kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3 and inspect the owner chain. Rollback returns the workload template, not the external database, messages, or feature state that the new version may already have changed.
Pause
Pause is the outcome to preserve; the cost is explicit: Keeping many revisions makes diagnosis convenient but adds ReplicaSet metadata; automatic rollback without compatibility tests can oscillate between two bad releases.
Verification evidence
The evidence command is kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3. It connects the declaration to this behavior: Roll back bad releases, inspect revision history, and pause/resume rollouts.

Visual diagram

Loading interactive diagram

Theory & deep dive

How Rollback reaches the intended state

Roll back bad releases, inspect revision history, and pause/resume rollouts. Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.

The concrete checkpoint is kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3; compare the Rollback owner, Revision History state, and Pause outcome instead of treating YAML acceptance as proof.

Verify Revision History, not only object creation

Run kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3 after the change and correlate the result with Events and the owning object. Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.

Key takeaway: Rollback is implemented only when this invariant remains observable: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.

Revision History: failure boundary and production cost

Rollback returns the workload template, not the external database, messages, or feature state that the new version may already have changed. The prerequisite contract is concrete: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.

Keeping many revisions makes diagnosis convenient but adds ReplicaSet metadata; automatic rollback without compatibility tests can oscillate between two bad releases. A safe design limits blast radius, records the last good configuration, and uses kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3 as a deterministic rollback checkpoint.

Recover from Revision History drift

Capture the current state with kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Rollback returns the workload template, not the external database, messages, or feature state that the new version may already have changed.

Key takeaway: Accept the trade-off consciously: Keeping many revisions makes diagnosis convenient but adds ReplicaSet metadata; automatic rollback without compatibility tests can oscillate between two bad releases.

How it works, step by step

Step 1 of 4
Workload author

1. Declare workload intent

Write the controller-owned Pod or scaling intent and preserve the owner chain: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.

Rollback contract → owned state
Key numbers at this step
Goal
Roll back bad releases, inspect revision history, and pause/resume rollouts.
Owner
Rollback

When to use it & trade-offs

What it is

Roll back bad releases, inspect revision history, and pause/resume rollouts. Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.

Why it matters: Rollback returns the workload template, not the external database, messages, or feature state that the new version may already have changed. The invariant at risk is specific: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior. The quickest fact check before changing the design is kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3.

When to reach for it

  • Use Rollback to enforce this invariant: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.
  • Use Revision History evidence from kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3 in reviews and incident timelines. Roll back bad releases, inspect revision history, and pause/resume rollouts.
  • Choose the progressive-delivery layer route only when this cost is justified by governance or scale: Keeping many revisions makes diagnosis convenient but adds ReplicaSet metadata; automatic rollback without compatibility tests can oscillate between two bad releases.

When to avoid or be careful

  • Avoid assuming Rollback is complete after YAML submission; the required behavior is concrete: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.
  • Avoid treating the next symptom as random; check the owner and state with kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3 first: Rollback returns the workload template, not the external database, messages, or feature state that the new version may already have changed.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Keeping many revisions makes diagnosis convenient but adds ReplicaSet metadata; automatic rollback without compatibility tests can oscillate between two bad releases.

Native, manual, and managed paths for Rollback

Controller-managed workload
Best for: Roll back bad releases, inspect revision history, and pause/resume rollouts. A concrete incident check is kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3.

Strengths: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.

Watch out: Keeping many revisions makes diagnosis convenient but adds ReplicaSet metadata; automatic rollback without compatibility tests can oscillate between two bad releases. Recovery must also recognize this signal: Rollback returns the workload template, not the external database, messages, or feature state that the new version may already have changed.

Hand-managed Pods
Best for: Quickly testing the Revision History assumption with kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3; the expected invariant is: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.

Strengths: kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3 gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike Rollback, it does not make this symptom self-documenting: Rollback returns the workload template, not the external database, messages, or feature state that the new version may already have changed.

Progressive-delivery layer
Best for: Teams that need Pause integrated with guardrails; the evidence path is kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.

Watch out: The added platform ownership buys value at this cost: Keeping many revisions makes diagnosis convenient but adds ReplicaSet metadata; automatic rollback without compatibility tests can oscillate between two bad releases.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.
  • Trace Rollback to Pause through Revision History; the invariant is: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.
  • Recognize the symptom: Rollback returns the workload template, not the external database, messages, or feature state that the new version may already have changed.
  • Justify the cost: Keeping many revisions makes diagnosis convenient but adds ReplicaSet metadata; automatic rollback without compatibility tests can oscillate between two bad releases.
  • Verify with kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3 instead of only inspecting YAML.

Benchmarks & rules of thumb

10 -
default revisionHistoryLimit for a Deployment
1 -
undo target step when no revision is named
0 -
rollback coverage for schema or message migrations by itself

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the Rollback owner contract: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior.
  • Ignoring this telltale condition leads to unrelated changes: Rollback returns the workload template, not the external database, messages, or feature state that the new version may already have changed.
  • Repeating kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3 without an owner for remediation wastes retry cost. Keeping many revisions makes diagnosis convenient but adds ReplicaSet metadata; automatic rollback without compatibility tests can oscillate between two bad releases.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior?
  • Which owner object, logs, and Events would you inspect for this symptom-Rollback returns the workload template, not the external database, messages, or feature state that the new version may already have changed-?
  • At what threshold would this cost become unacceptable: Keeping many revisions makes diagnosis convenient but adds ReplicaSet metadata; automatic rollback without compatibility tests can oscillate between two bad releases?
Interview tip: Interview sequence: state the invariant, run kubectl rollout history deploy/api; kubectl rollout pause deploy/api; kubectl rollout undo deploy/api --to-revision=3, name the failure, then justify the cost. Invariant: Deployment revision history records template rollouts and rollout undo selects a prior ReplicaSet template, while pause stops controller promotion without freezing independent application behavior. Failure: Rollback returns the workload template, not the external database, messages, or feature state that the new version may already have changed. Cost: Keeping many revisions makes diagnosis convenient but adds ReplicaSet metadata; automatic rollback without compatibility tests can oscillate between two bad releases.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Deployment Rollbacks, Revision History & Pausing Rollouts with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Rolling Updates, maxSurge & maxUnavailable Strategies
Next topic
StatefulSets for Stateful Applications (Databases, Queues, Distributed Systems)