kubectl rollout undo rolls a Deployment back to an earlier revision
Answer: kubectl rollout undo deployment/NAME rolls back to the previous rollout. Add --to-revision=N to roll back to a specific revision, and check the revisions first with kubectl rollout history.
Commands
kubectl rollout history deployment/nginx-deployment
kubectl rollout history deployment/nginx-deployment --revision=2
kubectl rollout undo deployment/nginx-deployment
kubectl rollout undo deployment/nginx-deployment --to-revision=2
kubectl rollout undo --dry-run=server deployment/abc
The same command also works on other rollout types, for example kubectl rollout undo daemonset/abc --to-revision=3. With --dry-run=server, kubectl submits a server-side request without persisting the resource.
Where the history comes from
The system keeps all of a Deployment's rollout history by default, so you can roll back anytime. The configuration of each Deployment revision is stored in its ReplicaSets; once an old ReplicaSet is deleted, you lose the ability to roll back to that revision.
.spec.revisionHistoryLimit sets how many old ReplicaSets to retain to allow rollback. By default, 10 old ReplicaSets will be kept. The rest will be garbage-collected in the background.
Recording why a revision exists
The CHANGE-CAUSE column in kubectl rollout history is copied from the Deployment annotation kubernetes.io/change-cause. Set it by annotating the Deployment, for example with kubectl annotate. The older --record flag is deprecated.
See also
Claims
- id: C1 claim: The command rolls back to a previous rollout. source: S1 evidence: "Roll back to a previous rollout."
- id: C2 claim: Server dry-run submits the request without persisting the resource. source: S1 evidence: "submit server-side request without persisting the resource"
- id: C3 claim: Use --to-revision to roll back to a specific revision. source: S2 evidence: "you can rollback to a specific revision by specifying it with"
- id: C4 claim: Ten old ReplicaSets are kept by default. source: S2 evidence: "By default, 10 old ReplicaSets will be kept"
Sources
- [S1] kubectl rollout undo. Kubernetes docs. https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_undo/ . License: CC-BY-4.0. Accessed 2026-11-18.
- [S2] Deployments (source page). kubernetes/website (GitHub). https://github.com/kubernetes/website/blob/main/content/en/docs/concepts/workloads/controllers/deployment.md . License: CC-BY-4.0. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, kubectl rollout undo; kubernetes/website (GitHub), Deployments (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, kubectl rollout undo; kubernetes/website (GitHub), Deployments (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors.
Cite this
iinventedlight. 2026. "kubectl rollout undo rolls a Deployment back to an earlier revision." iinventedlight Library, iil:note:hnvfc1rc, version of 2026-11-18. https://iinventedlight.com/library/notes/kubernetes-rollout-undo/. License: CC-BY-4.0.
@misc{iil_note_hnvfc1rc,
author = {{iinventedlight}},
title = {{kubectl rollout undo rolls a Deployment back to an earlier revision}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/kubernetes-rollout-undo/},
note = {Permanent ID iil:note:hnvfc1rc. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/kubernetes-rollout-undo.md.