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

DeploymentReplicaSet v1ReplicaSet v2create v2, scale to 1pod readyscale v1 to 2scale v2 to 2scale v1 to 1scale v2 to 3scale v1 to 0 (kept for rollback)
A rolling update replaces pods gradually, gated by readiness.

Rollout knobs

SettingEffectTypical value
maxSurgeExtra pods allowed during rollout25% or 1
maxUnavailablePods allowed to be unavailable0 for zero-downtime
minReadySecondsPod must stay ready this long to count10-30 s
progressDeadlineSecondsMark rollout failed if stuck600 s
revisionHistoryLimitOld ReplicaSets kept for rollback5-10

Deployment strategies

StrategyHowTrade-off
RollingUpdate (default)Gradual replacementTwo versions live briefly
RecreateKill all, then start newDowntime; needed for some stateful apps
Blue-greenTwo full environments, switch trafficDouble resources, instant rollback
CanarySmall % of traffic to new version firstNeeds 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: 10

Ship, 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=3

Record 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" --overwrite

Common 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.

More DevOps articles