A rollout must never reduce capacity below current replicas. How do you configure the strategy?
IntermediateScenarioDeployments and rollouts
Answer
Situation read → A latency-sensitive API with 10 replicas that cannot lose capacity during deploys.
What I'd do →
- Set
strategy.rollingUpdate.maxUnavailable: 0andmaxSurge: 25%(or a number) - Make sure the cluster has headroom for the surge pods or the rollout will hang Pending
- Add a readinessProbe so a new pod only counts as available once it can serve
- Set
minReadySeconds: 10to avoid counting a pod that flaps right after start - Verify with
kubectl rollout statusand watchkubectl get rs -w
Why → With maxUnavailable 0 the controller must bring up a new Ready pod before it terminates an old one, so serving capacity never drops.
Interview tip → Point out the trade-off: you need spare capacity for surge, otherwise the rollout stalls.
More on Deployments and rollouts
You applied a new image tag and the rollout seems stuck at "1 out of 3 new replicas have been updated". What do you check first?BeginnerHow do you roll back a bad release and verify you are back on the previous version?BeginnerYou need a blue/green deployment without a service mesh. How do you do it with plain Kubernetes?IntermediateHow would you do a canary release with only Deployments and a Service?IntermediateWhat is the difference between Recreate and RollingUpdate strategies and when would you pick Recreate?BeginnerAfter a deploy, pods are Ready but users get 502s for a few seconds. What is happening and how do you fix it?Intermediate