Pcornel
Browse topics
Options
Recent
Favorites
Containers · Technical reference

Deployments and Rolling Updates

Direct answer

A Deployment manages ReplicaSets for stateless pods and performs rolling updates (maxSurge/maxUnavailable) with rollback history.

When to use this

Use it to deploy and update stateless applications, or when a rollout hangs.

First 30 seconds

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.

Operational verification

new template → new ReplicaSet → scale up/down per strategy → old RS scaled to 0

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Docker / containerd / Podman / Kubernetes / OCI-compatible platforms
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformDocker / containerd / Podman / Kubernetes / OCI-compatible platforms
Scope / prerequisiteUse it to deploy and update stateless applications, or when a rollout hangs.
What next?2 suggested next steps
Evidence0
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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.

Key points

A rollout waits for readiness — broken probes or images stall it. kubectl rollout undo rolls back. Set progressDeadlineSeconds.

Key checks
  • kubectl rollout status deploy/<d> — first check for this topic
  • kubectl get pods -o wide — pods, status, node, IP
  • kubectl describe pod <pod> — events and conditions
  • kubectl 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.

SettingEffect
maxSurge: 0, maxUnavailable: 1No extra capacity needed; one replica less during rollout
maxSurge: 1, maxUnavailable: 0Never below full capacity; needs room for one extra Pod
minReadySeconds: 10A Pod must stay Ready 10 s before it counts as available
progressDeadlineSeconds: 600After 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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
Terminology layer

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.

Aliases that resolve here
deployments and rolling updateskubernetes rolling updatekubectl rollout undo
Confirmation

Confirm action

Continue?