Skip to main content
This lesson explains how Kubernetes manages Deployment rollouts and rollbacks. When you create or update a Deployment, Kubernetes records each rollout as a new revision and creates a corresponding ReplicaSet. Revisioning makes it easy to track changes and revert to a previous working state when needed.
A slide titled "Rollout and Versioning" showing two revision groups of container icons: Revision 1 with multiple containers labeled nginx:1.7.0 and Revision 2 with containers labeled nginx:1.7.1, plus a central update/rollout icon.

Check rollout progress and history

  • Check rollout status:
Example output:
  • View rollout history and revisions:
Example output:
The CHANGE-CAUSE column appears only if a change-cause was recorded during the update (historically via --record). That flag has been deprecated in newer kubectl versions and may not be set.

Deployment update strategies

There are two common update strategies for Deployments:
  • Recreate: Kubernetes scales down the old ReplicaSet to zero replicas, then scales up the new ReplicaSet. This approach can cause downtime during the transition.
  • RollingUpdate (default): Kubernetes incrementally replaces old Pods with new Pods so that the application stays available during the upgrade.
If no strategy is specified in the Deployment manifest, Kubernetes uses RollingUpdate by default.
By default, Deployments use the RollingUpdate strategy to avoid downtime during upgrades.
A diagram titled "Deployment Strategy" comparing Recreate and Rolling Update, showing rows of nginx container icons labeled nginx:1.7.0 and nginx:1.7.1. Red downward arrows indicate old pods being stopped and green upward arrows show new pods starting, with an "Application down" box in the Recreate flow.

How to update a Deployment

“Updating” a Deployment means changing the pod template: for example, updating the container image, changing labels, or modifying replica counts. Two common approaches:
  1. Update the manifest and apply:
This updates the stored manifest and triggers a new rollout.
  1. Change the image directly:
Note: Using kubectl set image updates the live Deployment in the cluster but does not update your local manifest file — this can cause drift between your repository and cluster state.
If you use kubectl set image or other imperative commands, remember to update your source manifest to avoid drift between your Git/manifest and the cluster.
Example Deployment manifest (corrected YAML):
Example commands and output:

Inspecting Deployment details

Use kubectl describe deployment to inspect a Deployment’s strategy, replica counts, annotations, and controller events. Example kubectl describe output for a Recreate strategy:
Example kubectl describe output for a RollingUpdate strategy:

How Deployments upgrade under the hood

  • Creating a Deployment (for example, with five replicas) creates a ReplicaSet.
  • The ReplicaSet creates Pods based on the pod template.
  • When you change the pod template, the Deployment creates a new ReplicaSet and moves Pods from the old ReplicaSet to the new one according to the chosen strategy (Recreate or RollingUpdate). The old ReplicaSet typically remains in the cluster so you can roll back.
A diagram titled "Upgrades" showing a Kubernetes Deployment with two ReplicaSets (ReplicaSet-1 and ReplicaSet-2). Each ReplicaSet contains multiple Pod icons, with some pods visually highlighted to indicate upgrading or replacement.
You can list ReplicaSets to observe the results of upgrades:
Example before rollback:

Rollback (undo a rollout)

If a new rollout is faulty, you can revert to a previous revision. Undo the most recent rollout:
Example:
After the rollback, ReplicaSets reflect the previous revision being scaled back up and the faulty one scaled down:

Quick reference — useful commands

Watch Video

Practice Lab