Kubernetes Deployments: Rolling Updates, Rollbacks and Strategies
How Deployments manage ReplicaSets, configure rolling updates with maxSurge and maxUnavailable, roll back safely, and when to use blue-green or canary.
Published December 1, 2026
A Deployment is how most stateless applications run on Kubernetes. It keeps a set number of identical pods running and, crucially, changes them safely when you ship a new version. Understanding how rollouts work, and how to tune them, is the difference between invisible deploys and brief outages.
The concept
A Deployment does not manage pods directly. It manages ReplicaSets, and each ReplicaSet manages pods for one version of the pod template. When you change the template (a new image tag, an env var), the Deployment creates a new ReplicaSet and gradually scales it up while scaling the old one down.
The RollingUpdate strategy is controlled by maxSurge (how many extra pods may exist during the rollout) and maxUnavailable (how many pods may be unready). Readiness probes gate the process: a new pod only counts as available once its readiness probe passes, so a broken version stalls the rollout instead of replacing healthy pods. Old ReplicaSets are kept for rollbacks.
How a rolling update proceeds
Rollout knobs
| Setting | Effect | Typical value |
|---|---|---|
| maxSurge | Extra pods allowed during rollout | 25% or 1 |
| maxUnavailable | Pods allowed to be unavailable | 0 for zero-downtime |
| minReadySeconds | Pod must stay ready this long to count | 10-30 s |
| progressDeadlineSeconds | Mark rollout failed if stuck | 600 s |
| revisionHistoryLimit | Old ReplicaSets kept for rollback | 5-10 |
Deployment strategies
| Strategy | How | Trade-off |
|---|---|---|
| RollingUpdate (default) | Gradual replacement | Two versions live briefly |
| Recreate | Kill all, then start new | Downtime; needed for some stateful apps |
| Blue-green | Two full environments, switch traffic | Double resources, instant rollback |
| Canary | Small % of traffic to new version first | Needs traffic splitting (mesh, Gateway, Argo Rollouts) |
Practical examples
Zero-downtime rollout settings
Never drop below desired capacity.
spec:
replicas: 4
strategy:
type: RollingUpdate
rollingUpdate: { maxSurge: 1, maxUnavailable: 0 }
minReadySeconds: 10Ship, watch and roll back
kubectl rollout commands cover the lifecycle.
kubectl set image deploy/web web=registry.example.com/web:1.8.2
kubectl rollout status deploy/web --timeout=5m
kubectl rollout history deploy/web
kubectl rollout undo deploy/web # back to previous revision
kubectl rollout undo deploy/web --to-revision=3Record why a revision exists
The change-cause annotation shows up in rollout history.
kubectl annotate deploy/web kubernetes.io/change-cause="release 1.8.2: fix checkout timeout" --overwriteCommon mistakes
- No readiness probe, so broken pods receive traffic and the rollout "succeeds".
- Using the mutable latest tag, making rollbacks meaningless.
- maxUnavailable too high for small replica counts, causing capacity drops.
- Database migrations that break the old version still running during the rollout.
Key takeaways
- Deployments manage ReplicaSets, one per template version.
- maxSurge and maxUnavailable control rollout pace and capacity.
- Readiness probes are what make rollouts safe.
- Use immutable image tags and kubectl rollout undo for fast recovery.
FAQ
Why do two versions run at once?
During a rolling update both ReplicaSets have pods; make sure old and new versions are compatible with the same database and APIs.
How do I pause a rollout?
kubectl rollout pause deploy/web stops progress; resume with kubectl rollout resume.
Can Kubernetes do canary natively?
Not with fine-grained traffic percentages; use the Gateway API, a service mesh or tools like Argo Rollouts or Flagger.