🔧 The Rolling Update That Took Every Pod Down at the Same Time
A Deployment’s RollingUpdate strategy without explicit maxUnavailable and maxSurge values falls back to 25% for each, which is a sensible, gradual setting for a Deployment with a reasonably large number of replicas. For a Deployment with only one or two replicas, that same percentage rounds in ways that stop being gradual at all, and combined with a resource constraint or a PodDisruptionBudget that delays the new surge pod from scheduling in time, a routine rollout can briefly leave the service with meaningfully fewer available replicas than anyone intended.
🔎 The Problem
apiVersion: apps/v1
kind: Deployment
metadata:
name: checkout-service
spec:
replicas: 2
strategy:
type: RollingUpdate
# No explicit maxUnavailable/maxSurge set - defaults apply:
# maxUnavailable: 25%, maxSurge: 25%
template:
spec:
containers:
- name: checkout
image: checkout-service:v2
# With replicas: 2, 25% rounds down for maxUnavailable, so
# Kubernetes leans on maxSurge instead - BUT when resource limits or
# a PodDisruptionBudget block the surge pod from scheduling in time,
# Kubernetes can still take an existing pod down before the new one
# is ready, briefly leaving only 1 of 2 replicas available during
# what looked like it should have been a zero-downtime rollout.
✅ Fix: Set Explicit Numbers, and Add a PodDisruptionBudget
- Set maxUnavailable and maxSurge explicitly (as absolute numbers, not just percentages) for any Deployment with a small replica count, rather than relying on default percentage-based rounding behavior to produce the gradual rollout a larger replica count would get automatically.
- Add a PodDisruptionBudget with minAvailable set to the actual number of replicas that must stay up at all times, which gives the scheduler a hard constraint to respect during voluntary disruptions like a rolling update, rather than just a strategy-level hint.
- For a genuinely small, latency-sensitive service, increase the replica count itself if resources allow it – percentage-based rolling update math naturally gets smoother and more forgiving the more replicas there are to round against.
⚠️ Why This Is Easy to Miss
- A rolling update strategy configured with no explicit numbers isn’t missing anything from the YAML’s perspective – the defaults are valid and commonly fine, which means this specific gap only shows up for Deployments with a small enough replica count that the default percentages round in an unhelpful direction.
- The dip in available replicas during a rollout is often brief enough (seconds) that it only gets noticed through an actual request failure rate spike or a PodDisruptionBudget violation alert, not through anything in kubectl rollout status, which reports the rollout as proceeding normally the entire time.
A rolling update’s default settings assume there are enough pods for a percentage to mean something – with only a couple of replicas, that same percentage can round down to zero room for error.




