lifecycle

kubectl rollout

Manages the deployment lifecycle of Deployments, StatefulSets, and DaemonSets. Subcommands cover watching progress, rolling back to a revision, restarting all pods, and pausing/resuming controller reconciliation.

kubectl rollout SUBCOMMAND (status|history|undo|restart|pause|resume) TYPE/NAME [flags]

Common flags

Flag Purpose
--revision Target revision for history or undo.
--to-revision Revision to roll back to (undo default is previous).
--timeout Max wait for rollout status to succeed.
-w, --watch Watch the rollout status until it completes (default true for status).
-n, --namespace Namespace of the workload.

Examples

kubectl rollout status deploy/web --timeout=2m

Wait for the Deployment to finish rolling out.

kubectl rollout undo deploy/web

Roll back to the previous ReplicaSet revision.

kubectl rollout restart deploy/web

Trigger a rolling restart (updates pod-template annotation).

kubectl rollout history deploy/web --revision=3

Show the pod template of a specific revision.

Gotcha

restart only works on Deployments/DaemonSets/StatefulSets, not Jobs or bare Pods. undo picks the previous ReplicaSet - if you rolled forward twice, run history first.

Related commands

← All kubectl commands · Docker vs Kubernetes