Active Nerds
Module #60 · beginner Article

Rolling Update Strategy: Zero-Downtime Deployment Control with maxSurge and maxUnavailable

A rolling update gradually replaces old pods with new ones, controlled by `maxSurge` (extra pods allowed) and `maxUnavailable` (pods that can be down) — allo...

4 min read+10 XPPublished 2026-07-03

Quick Answer: A rolling update gradually replaces old pods with new ones, controlled by maxSurge (extra pods allowed) and maxUnavailable (pods that can be down) — allowing zero-downtime deployments.

Detailed Answer:

strategy:
  type: RollingUpdate
  rollingUpdate:
    maxSurge: 1           # Can go above desired replica count by 1 during update
    maxUnavailable: 0     # Zero pods can be unavailable (zero-downtime)

# With replicas: 3, maxSurge: 1, maxUnavailable: 0:
# Step 1: Start 1 new pod (total: 4 — 3 old + 1 new)
# Step 2: New pod passes readiness probe
# Step 3: Terminate 1 old pod (total: 3 — 2 old + 1 new)
# Step 4: Repeat until all 3 are new version
# Trigger a rolling update
kubectl set image deployment/my-app app=myapp:v2.0.0

# Watch it happen in real time
kubectl rollout status deployment/my-app
# Waiting for deployment "my-app" rollout to finish: 1 out of 3 new replicas updated...
# Waiting for deployment "my-app" rollout to finish: 2 out of 3 new replicas updated...
# deployment "my-app" successfully rolled out

# View rollout history
kubectl rollout history deployment/my-app
# REVISION  CHANGE-CAUSE
# 1         <none>
# 2         <none>

# Roll back immediately if something goes wrong
kubectl rollout undo deployment/my-app

# Roll back to specific revision
kubectl rollout undo deployment/my-app --to-revision=1

Critical Insight — Readiness Probes Gate Updates:

The rolling update waits for each new pod to pass its readiness probe before terminating an old pod. Without a readiness probe, Kubernetes assumes the pod is ready immediately after the container starts — which can route traffic to a pod that hasn't finished initializing.

Key Takeaway: Always configure readiness probes — they are the gate that prevents a bad deployment from rolling out fully before you notice something is wrong.


Finished reading?

Mark as complete to claim your +10 XP and track progress.