What "Cluster Ready" Actually Means

Some time ago, on one of my SRE engagements, we kept seeing a strange pattern in the logs: bursts of error-level entries, several times a day, with no obvious trigger. No deployment had gone out. No traffic spike. No incident anyone could point to. And yet, several times a day, our alerting fired on error rates for a service that appeared to be working fine.
It took a while to find the cause, because the errors didn’t correlate with anything we were watching. What they did correlate with, once we cross-referenced timestamps against the cluster’s own event log, was completely mundane: pods being rescheduled. Not crashing. Simply moved — by the horizontal pod autoscaler, by a node drain, by normal cluster housekeeping.
The errors weren’t even coming from the terminated pod. It was already gone by the time they appeared. They came from two other places: the cluster, which hadn’t yet removed the pod from its own state and was still calling its health check endpoints, and other services, which couldn’t reach that instance because it hadn’t yet been removed from traffic distribution.
The application had never been written to expect that its process could be told to stop at any moment. It didn’t catch SIGTERM — it terminated immediately, well before the rest of the cluster had updated its state to reflect that it was gone.
Nobody had done anything wrong in the sense of writing buggy business logic. The application worked. It just didn’t know it was going to live in a cluster.
That gap — between “the application works” and “the application is ready to run in a cluster” — is what this article is about. It shows up in a handful of recurring places, and once you’ve seen the pattern, you start noticing it everywhere.
Pods are not servers
The mental model a lot of application code still carries is the old one: a long-lived process on a machine that’s yours, that stays up until you decide to take it down. A cluster doesn’t work like that, and it isn’t supposed to. Pods get killed and replaced constantly — by autoscaling, by rolling deployments, by node maintenance, by the scheduler simply deciding your workload would fit better somewhere else. None of that is a failure. It’s the cluster doing its job.
The practical consequence is that “my process is running” can no longer be your baseline assumption. Your application has to assume, as a default operating condition rather than an edge case, that it can be told to stop, that a fresh, identical copy of itself can appear at any moment, and that requests may hit any of several interchangeable replicas. That last point is also how scaling works here: you handle more load by running more copies of the same application, not by giving one instance more memory. Everything below follows from taking that seriously from the start, instead of adding it only after something breaks.
Handling the signal to shut down
When Kubernetes wants a pod gone, it doesn’t just kill the process. It sends SIGTERM, waits up to terminationGracePeriodSeconds (30 seconds by default), and only sends SIGKILL if the container hasn’t exited by then. That grace period exists specifically so your application can shut down cleanly: finish in-flight requests, close database connections, release locks, flush anything buffered — instead of being terminated abruptly while it is still processing.
If your application doesn’t handle SIGTERM, that entire grace period is wasted — the process just exits immediately instead of using the time it was given to shut down cleanly. Some runtimes and base images never pass the signal on at all (a common case: your entrypoint is a shell script that isn’t PID 1 in a way that forwards signals correctly), which produces the same outcome.
This is the part that actually produced the error bursts in the story above: the rest of the cluster doesn’t learn “this pod is gone” at the same instant the process exits. The kubelet may still be polling the pod’s health endpoints for a moment; kube-proxy (or your ingress controller) needs its own propagation window — anywhere from a few hundred milliseconds to several seconds depending on cluster size — before other services stop being told to route traffic to that pod’s address. If the process has already terminated before either of those has updated, every probe call or forwarded request lands on nothing. From the cluster’s own probe logs, or from the calling service’s side, that is indistinguishable from an application bug — it isn’t one, it’s a pod that was already supposed to be gone but hadn’t been fully removed from the cluster’s bookkeeping yet. A short preStop hook — a plain sleep, typically 5–15 seconds — gives the process extra time to stay reachable until that update is complete, instead of leaving that gap open. Note that this sleep runs before SIGTERM is sent and is deducted from terminationGracePeriodSeconds rather than added to it, so the two have to be sized together: a 25-second preStop under the 30-second default leaves the application five seconds to drain, which is worse than having no preStop at all.
Once we added proper signal handling and a preStop delay to the service in question, the mysterious error bursts disappeared — not because the pods stopped being rescheduled (they still were, constantly, as they should be), but because rescheduling stopped being something the application experienced as a crash.
Health probes are not interchangeable
The other half of that incident was alerting noise, and the probes were directly involved in producing it. The cluster kept calling health check endpoints on a pod whose process had already exited, and every one of those calls failed and was logged as an error. Nothing in the setup distinguished a probe failing because the pod was already on its way out from a probe failing because the application was genuinely broken. Both produced the same error-level entries, and the error-rate alerting counted both the same way.
That distinction is worth taking seriously well beyond this one incident. Readiness, liveness, and startup probes answer three genuinely different questions, and treating them as one setting you copy-paste into every deployment is how you end up with either pods that get killed for no reason or pods that stay in rotation while quietly broken.
| Probe | What it answers | What happens on failure |
|---|---|---|
| Readiness | Can this pod take traffic right now? | Pod is pulled out of service — no restart |
| Liveness | Is this process in a state it can’t recover from? | Container is restarted |
| Startup | Has this pod finished booting yet? | Delays readiness/liveness checks until it passes |
A readiness probe failing is not an incident — it’s the mechanism working as intended, temporarily taking a pod out of rotation because it’s overloaded, still warming a cache, or mid-shutdown. A liveness probe failing is more serious: it says the process is stuck and a restart is the only way out. Pointing both at the same shallow endpoint with the same thresholds, which I still see fairly often, means you lose the distinction entirely — a slow dependency call can trigger a full container restart instead of a brief, harmless pause in traffic.
The same distinction has to survive into your alerting. If a failed call against a pod that was already being replaced is counted identically to a failed call against a pod that is genuinely stuck, you will page people for normal cluster behaviour. That is what made the incident above so hard to diagnose: the missing signal handling produced the failed calls, and alerting that treated every failure as equivalent turned them into pages that pointed at nothing.
Stateless by default
Once you accept that pods are disposable and interchangeable, statelessness stops being an abstract principle and becomes the default that the rest of the platform assumes. A request has to be servable by whichever replica the load balancer happens to route it to — not “the one that handled the last request from this user,” not “the one that’s been up the longest.” Anything that depends on local, in-memory, or on-disk state that isn’t shared belongs in a place all replicas can reach: a database, a distributed cache, object storage — not the pod’s own filesystem or process memory. Stateful workloads are of course possible, and StatefulSets and persistent volumes exist precisely for them — but they should be a deliberate decision with an explicit answer for what happens when a replica is replaced, not something a service ends up with because nobody asked the question.
This is also where the problem is easiest to miss, because the code involved looks entirely reasonable on its own: someone builds a perfectly reasonable single-instance feature — say, a scheduled job — directly into a service, without accounting for the fact that “the service” isn’t one process, it’s N identical replicas, all of which will run that same scheduled code at the same time unless something explicitly coordinates them. That specific failure mode — and why I would use a primitive the platform already provides instead of writing coordination logic inside the application — is enough material for its own article, so I’ll leave it there for now.
Assume the cluster is hostile, not just dynamic
Security follows the same logic — assume replacement, assume you don’t control the surrounding environment — applied to what is around the application rather than to its own lifecycle. Run as non-root, so that a compromised process doesn’t also inherit the ability to modify the container it runs in. Make the filesystem read-only wherever the application allows it; in my experience that also brings hidden writes to local state to the surface, which is useful information regardless of the security benefit. Keep the image minimal — fewer packages means a smaller attack surface and fewer things that can become outdated without anyone noticing. Don’t load or execute external code you haven’t pinned and checksummed. And don’t treat network adjacency as authorisation: being able to reach another namespace is not the same as being permitted to.
None of this is exotic. It is the same discipline as the rest of this article applied to a different failure mode. Assuming the pod is alone on a trusted private network is as wrong as assuming it will never be stopped in the middle of a request — and it is the assumption least likely to be written down anywhere, which is exactly what makes it hard to review.
Generated code still has to be understood
It is a fair question why I would write this down in detail at a point where much of the industry would rather have work like this generated than understood. A model can produce a deployment manifest with a preStop hook and three correctly separated probes faster than I can type one. I use these tools myself, and I am not going to argue that anyone should stop.
But two things do not transfer to the tool. The first is ownership. Whatever runs in production is yours, and if it produces error bursts at three in the morning, you are the one who has to explain them. To own a result you have to be able to judge it — to look at a generated manifest and notice that the preStop sleep is longer than the grace period it is deducted from, or that liveness and readiness point at the same endpoint with the same thresholds. Accepting output you cannot assess is not delegation. It is hoping.
The second is instruction. You have to be able to say what you want, and “make this cluster ready” is not a specification. The useful version of that request contains exactly the understanding this article is about: what has to happen on SIGTERM, which probe answers which question, what a replica is allowed to assume about the one next to it. The better these tools become at producing an answer, the more of the remaining work consists of asking the right question and recognising a good answer when you see one. Neither of those is something the tool can do on your behalf.
The real shift
None of the individual practices here — graceful shutdown, correctly scoped probes, statelessness, a hardened container — are new or unusual advice. Most teams can name all four. The harder part is that they are not four separate items on a checklist: they are consequences of a single assumption, and a team that adopts them one at a time in response to incidents gets the mechanisms without the reasoning that connects them.
So here is the definition I would give. An application is cluster ready when it behaves correctly without knowing where, when, or for how long it is running — and when the signals it produces allow an operator to tell normal cluster behaviour apart from an actual fault.
The second half of that sentence is the part usually left out, and it is what made the incident I opened with so difficult. Nothing was broken. The application worked, the cluster worked, and pods were being replaced exactly as intended. What was missing was any way to distinguish a pod being replaced, which happened dozens of times a day and meant nothing, from a pod failing, which would have meant something. Until an application can express that difference, someone will keep being paged to look at it — and after enough false alarms, they will stop looking carefully.