A container can be alive without being able to serve useful traffic. It can also need more time to start without being broken. Treating those conditions as one health signal makes a small deployment problem harder to diagnose: traffic reaches an unprepared process, or repeated restarts prevent it from ever finishing initialization.
Kubernetes separates startup, readiness and liveness probes. Its probe documentation describes their different effects: readiness controls whether a container is ready to receive service traffic, while failed liveness checks can lead to a restart. A startup probe can protect slow initialization from premature liveness checks. The practical task is to decide which application condition belongs to each mechanism.
Start with the behavior you need
Imagine an inventory API that loads a small local catalog before answering requests. It also consults a shared database for changes. During startup, returning a successful readiness response before the catalog has loaded would expose customers to incomplete results. A failed catalog load might eventually justify restarting the process, but a temporarily unavailable shared database does not necessarily mean a restart will help.
Write these conditions in ordinary language before implementing endpoints. The process has started. The local state required for a useful response is available. The process can make progress. A dependency is temporarily unavailable. Each statement suggests a different operational response. Naming them prevents one endpoint from accumulating incompatible responsibilities.
Do not begin by copying a probe block from another application. A static frontend, queue consumer and transaction API can have very different startup and recovery behavior. Configuration that works for one workload can hide a fault or create unnecessary disruption in another.
Make readiness about accepting traffic
Readiness should answer whether sending this instance another request is sensible. For the fictional inventory API, this includes successful initialization and an application state that can handle the supported request path. During deliberate shutdown, the service may need to stop accepting new requests while it completes work already in progress.
Be careful when including shared dependencies in readiness. If every replica becomes unready whenever the same database is slow, all application capacity may disappear at once. That can be appropriate when no request can possibly succeed, but it is a consequential design choice. Some applications can serve cached reads or a useful degraded response instead.
Define what happens to different request classes. A service that can still answer public catalog requests but cannot accept writes has a more complex state than healthy or unhealthy. It may need explicit degraded behavior within the application, with readiness reserved for conditions that make the entire instance unsuitable for traffic.
Use liveness only when a restart can help
Liveness is not a miniature end-to-end availability monitor. It should detect a local condition for which restarting this container is a reasonable recovery action. An event loop that can no longer make progress is different from a remote payment provider returning errors.
Ask a concrete question for each proposed liveness check: if this fails, what will a new instance do differently? If the answer is that it will connect to the same unavailable database with the same credentials, repeated restarts probably add noise. They can also discard useful diagnostic state or lengthen recovery by repeating expensive initialization.
A liveness endpoint must itself remain simple enough to work under the conditions it is intended to detect. Avoid making it depend on a long chain of ordinary request processing and external calls unless that dependency is intentional. Equally, returning a constant success value without examining any relevant local state may create false confidence. Match the implementation to a documented failure mode.
Give startup its own budget
Startup behavior often changes as datasets grow or deployment environments differ. Measure the expected stages: process initialization, configuration loading, local cache preparation and any required migration coordination. Separate normally slow initialization from a startup process that has stopped making progress.
A startup probe can keep the normal liveness policy from applying too early. The budget should reflect observed startup behavior and the deployment’s acceptable delay, rather than an arbitrary large number. A generous threshold can prevent restart loops, but it can also leave a broken release waiting for a long time before an operator receives a useful signal.
Make initialization visible through logs or metrics that identify the stage without exposing secrets. If a rollout pauses, responders should be able to distinguish downloading data from waiting indefinitely for a lock. A single message saying that the application is starting is rarely enough to make that distinction.
Choose thresholds as a combined policy
Probe interval, timeout and failure threshold interact. Review them together rather than approving each number independently. A short timeout against an endpoint that performs variable remote work can classify routine slowness as failure. A long interval with many required failures can leave an unusable instance receiving traffic longer than intended.
Create a small timing table for the behavior you expect. Record how quickly a local deadlock should cause a restart, how quickly an unprepared instance should stop receiving traffic, and how much temporary delay is acceptable. Check the configured values against these intentions using the behavior documented for the Kubernetes version you run.
Include resource contention in testing. A process under CPU pressure may respond to health requests slowly even though restarting it does not solve the capacity shortage. Distinguish a policy intended to recover an irreparably stuck instance from a policy that accidentally makes overloaded instances repeatedly pay their startup cost.
Keep the probe route observable and limited
Health routes need appropriate network access for the platform, but they do not need to expose internal connection strings, dependency credentials or complete configuration. Return only the information required for the probe. Put detailed troubleshooting context in controlled logs and dashboards.
Record probe failures in a way that lets operators connect them with restarts, deployment changes and request outcomes. A rising restart count is a symptom, not an explanation. A useful incident view shows whether failures began before or after customer errors, whether all replicas behave similarly, and which revision is affected.
Avoid interpreting a successful probe as proof that the service meets its customer objective. An instance can pass local checks while producing incorrect responses. Keep synthetic requests, application metrics and customer journey monitoring separate so that each signal has a clear purpose.
Test failures deliberately before rollout
Build a controlled test matrix around the decisions the probes make. Start a new instance with a deliberately slow initialization step. Confirm that it does not receive traffic prematurely and that the configured startup policy allows the expected delay. Then introduce a startup failure and verify that it eventually produces an actionable outcome.
Next, simulate a local application failure that the liveness check is designed to recognize. Observe the recovery behavior and confirm that the new instance can actually return to service. If the restart does not change the failure, revisit either the check or the proposed recovery mechanism.
Test a shared dependency interruption separately. Watch whether readiness removes every replica and whether the resulting customer response is the intended one. The purpose is not to make every test end with a green dashboard. It is to expose the consequences of the policy while the team can still revise it safely.
Coordinate probes with shutdown and deployment
Health checks exist within a wider lifecycle. Review how the application stops accepting new requests, handles active work and exits. A readiness transition alone does not document what happens to a request already being processed. Background jobs, streaming connections and transaction boundaries may require additional handling.
During a rolling update, examine the combined effect of startup delay, readiness changes and the deployment’s availability settings. A replacement instance that takes several minutes to initialize changes how quickly capacity can be replaced. A release can be technically healthy while proceeding more slowly than the team expects.
Write down who should intervene when progress stops and which evidence they need. Include the revision, probe state, restart history and relevant application stage. This makes the operational decision about continuing or reversing the rollout much easier than a generic instruction to inspect the pods.
Review the policy when application behavior changes
Probe definitions should evolve with the workload. Adding a new startup task, introducing a cache, moving a dependency or changing graceful shutdown can invalidate an older policy. Include a short probe review in the engineering work that changes those behaviors.
The final review should be understandable without reading the configuration file. Readiness answers whether this instance should receive new traffic. Liveness identifies a local state that a restart can plausibly repair. Startup protects legitimate initialization while still exposing failure. When those three sentences are specific to the application, the configuration has a useful operational foundation.