← All notes

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

Sources

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

Permanent ID: iil:note:hnvfc1rc

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.},
}

Markdown

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.