Use it to deploy and update stateless applications, or when a rollout hangs.
Deployments and Rolling Updates
A Deployment manages ReplicaSets for stateless pods and performs rolling updates (maxSurge/maxUnavailable) with rollback history.
1. kubectl rollout status deploy/<d>.
2. New ReplicaSet pods failing? kubectl get rs / pods.
3. Events: image or probe failures.
4. Undo: kubectl rollout undo deploy/<d>.
5. History: kubectl rollout history.
new template → new ReplicaSet → scale up/down per strategy → old RS scaled to 0
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 How to verify Verify boundary
Watch new Pods become Ready. If the rollout stalls, describe the new Pods for image, probe or scheduling errors. Roll back with kubectl rollout undo and confirm the previous image runs.
Step 2 Common failures Narrow the fault
Changing only a ConfigMap does not trigger a rollout. A failing readiness probe stalls the rollout with old Pods still serving. maxUnavailable 0 with no spare capacity can block progress.
A rollout waits for readiness — broken probes or images stall it. kubectl rollout undo rolls back. Set progressDeadlineSeconds.
kubectl rollout status deploy/<d>— first check for this topickubectl get pods -o wide— pods, status, node, IPkubectl describe pod <pod>— events and conditionskubectl logs <pod> [-c <c>] [--previous]— container logs (incl. previous crash)kubectl get events --sort-by=.lastTimestamp— recent cluster events
ReferenceWhat it is1 section · depth on demand
How it works
Each template change creates a new ReplicaSet with a hash label. The Deployment controller scales the new set up and the old one down, respecting maxSurge and maxUnavailable. progressDeadlineSeconds marks a rollout as failed if it does not progress.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
How many Pods during a rollout?
With replicas: 4, maxSurge: 25% and maxUnavailable: 25% (the defaults), Kubernetes allows up to 5 Pods in total (4 + 1 surge, rounded up) and requires at least 3 available (4 − 1, rounded down). It creates one new Pod, waits until it is Ready, removes one old Pod, and repeats.
| Setting | Effect |
|---|---|
maxSurge: 0, maxUnavailable: 1 | No extra capacity needed; one replica less during rollout |
maxSurge: 1, maxUnavailable: 0 | Never below full capacity; needs room for one extra Pod |
minReadySeconds: 10 | A Pod must stay Ready 10 s before it counts as available |
progressDeadlineSeconds: 600 | After 10 min without progress the rollout is marked failed |
Worked check of a stalled rollout
kubectl rollout status deploy/web --timeout=2m
# Waiting for deployment "web" rollout to finish: 1 out of 4 new replicas have been updated...
kubectl get rs -l app=web # new RS with 1 Pod, not Ready
kubectl describe pod -l app=web,pod-template-hash=<new-hash> | tail
kubectl get deploy web -o jsonpath='{.status.conditions[?(@.type=="Progressing")].reason}'
# ProgressDeadlineExceeded
A rollout that exceeded its deadline is not rolled back automatically; old Pods keep serving. Fix the cause or run kubectl rollout undo deploy/web.
Triggering a rollout without image change
Only changes to spec.template create a new ReplicaSet. kubectl rollout restart deploy/web adds a timestamp annotation to the template, which is the clean way to pick up changed ConfigMaps or Secrets consumed as environment variables.
Common mistakes
- No readiness probe during rolling updates.
ReferenceConfiguration & state1 section · depth on demand
Rollout commands
kubectl set image deploy/web web=myapp:1.5
kubectl rollout status deploy/web
kubectl rollout history deploy/web
kubectl rollout undo deploy/web --to-revision=3
kubectl rollout restart deploy/web
Documented example, not captured output. maxSurge/maxUnavailable control speed; readiness probes decide when new Pods receive traffic. A rollout stuck at "Waiting for deployment" usually means new Pods are not becoming Ready.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.