Zero-Downtime Kubernetes Deploys: Probes, Rolling Updates, and PodDisruptionBudgets
Kubernetes advertises rolling updates out of the box, yet many teams still see a burst of 502s on every deploy. The defaults are only part of the story: zero downtime needs correct probes, a sensible rollout strategy, graceful shutdown, and protection from voluntary disruptions like node drains. This post walks through each piece with manifests you can apply today. Why requests get dropped During…
Kubernetes offers rolling updates without downtime, but many teams still experience 502 errors during deployments. The solution lies in configuring readiness, liveness, and startup probes, a sensible rollout strategy, graceful shutdown, and protection from voluntary disruptions. During a rollout, three issues can arise: new pods receiving traffic before they're ready, old pods being killed while still handling requests, and endpoint removal and SIGTERM happening concurrently.
Kubernetes provides dedicated features to address these problems. The first step is setting up readiness, liveness, and startup probes. Readiness determines if a pod is part of the Service's endpoints; if it's not ready, traffic is stopped. Liveness checks if the container should be restarted, while startup holds off liveness checks until the app has booted.
The second step is choosing a rollout strategy that maintains capacity. Setting maxUnavailable to 0 ensures Kubernetes doesn't remove old pods until new ones are ready. maxSurge allows for creating additional pods above the desired count during the rollout. The minReadySeconds parameter ensures a new pod stays ready for at least 10 seconds before being considered available.
Lastly, graceful shutdown involves sending SIGTERM to the pod and waiting for it to finish handling in-flight requests before removing it from Service endpoints. Your application must handle SIGTERM by cleaning up in-flight requests.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.