What is a rolling deployment and how does it minimize downtime?
Learn what a rolling deployment is and how batch-by-batch instance updates minimize downtime, with maxUnavailable, maxSurge, health checks and interview tips.
Expected Interview Answer
A rolling deployment updates an application by replacing its instances in small batches one group at a time, so the remaining old instances keep serving traffic while new ones start up — achieving a zero-downtime release without a full duplicate environment.
The orchestrator takes down a few instances, deploys the new version to them, waits for their health checks to pass, adds them back to the load balancer, and only then moves to the next batch. Because a portion of capacity is always healthy and serving, users never see an outage. Parameters like maxUnavailable and maxSurge control how many instances update at once and how much extra capacity is allowed during the roll.
- Zero-downtime releases
- No need for a full duplicate environment
- Gradual exposure limits blast radius
- Automatic health checks gate each batch
- Efficient use of existing capacity
AI Mentor Explanation
A rolling deployment is like rotating fresh fielders onto the ground a couple at a time while the rest keep playing, so the match never pauses. Each new fielder is checked as ready before the next pair is swapped, and the game continues uninterrupted — just as new app instances replace old ones batch by batch while the remaining instances keep serving traffic.
Step-by-Step Explanation
Step 1
Split into batches
Divide the running instances into small groups controlled by maxUnavailable and maxSurge.
Step 2
Update a batch
Drain and replace the first group of instances with the new version.
Step 3
Run health checks
Wait for the new instances to pass readiness probes before sending them live traffic.
Step 4
Add back to the pool
Return the healthy new instances to the load balancer so they serve requests.
Step 5
Repeat until complete
Move to the next batch, and stop or roll back automatically if a batch fails its checks.
What Interviewer Expects
- Definition as batch-by-batch instance replacement
- Explanation of why some capacity always stays available
- Knowledge of maxUnavailable and maxSurge
- Role of readiness or health checks between batches
- How rollback works if a batch is unhealthy
Common Mistakes
- Confusing rolling with recreate, which causes downtime
- Ignoring readiness probes so unhealthy instances take traffic
- Forgetting backward compatibility between versions during the roll
- Not accounting for database or schema compatibility across mixed versions
- Assuming rollback is instant like blue-green
Best Answer (HR Friendly)
“A rolling deployment updates an app a few servers at a time instead of all at once, so the servers still running the old version keep handling users while the new ones start up. Because part of the system is always available, users never experience an outage during the release.”
Code Example
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 6
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
template:
spec:
containers:
- name: web
image: web:2.0
readinessProbe:
httpGet:
path: /healthz
port: 8080Follow-up Questions
- What do maxUnavailable and maxSurge control?
- How does a rolling deployment differ from blue-green?
- Why is backward compatibility important during a rolling update?
- How do readiness probes affect the rollout?
- How would you roll back a failed rolling deployment?
MCQ Practice
1. How does a rolling deployment avoid downtime?
It updates instances a batch at a time, so remaining healthy instances continue serving traffic throughout the release.
2. What does maxUnavailable control in a rolling update?
maxUnavailable caps how many instances may be unavailable at any moment, protecting serving capacity.
3. Which gate decides whether a new batch receives traffic?
New instances only receive live traffic after their readiness probes pass, before the next batch begins.
Flash Cards
What is a rolling deployment? — Replacing app instances in small batches so remaining instances keep serving traffic with zero downtime.
What does maxSurge do? — Allows a number of extra instances above the desired count during the rollout to maintain capacity.
What does maxUnavailable do? — Limits how many instances can be down at once during the update to protect availability.
Why do readiness probes matter? — They ensure new instances are healthy before receiving traffic and before the next batch updates.