Choosing the right health check prevents two costly deployment failures: restarting a healthy process because a dependency is slow, and sending users to an instance that is not ready to serve traffic. This guide compares liveness, readiness, and startup probes, then turns the distinctions into implementation and review checklists for cloud-native web services and background workers.
Overview
A health probe is a test performed by the platform or orchestrator against an application instance. The result influences a specific operational decision, so the endpoint should answer a specific question rather than expose a vague status message.
- Liveness: Is the process still able to make progress, or should the platform restart it?
- Readiness: Should this instance receive traffic or work right now?
- Startup: Has the application completed its initial startup phase so that normal liveness and readiness checks can begin?
These checks are related but interchangeable only in very simple applications. A database outage, for example, may make an instance unready without meaning that its process is stuck. Returning failure from a liveness check in that situation can cause a restart loop that increases load on the same unavailable dependency.
For Kubernetes health checks, the probe mechanism may be HTTP, TCP, a command executed in the container, or another platform-supported method. The exact fields and defaults vary by platform and runtime version, so treat the following patterns as design guidance and confirm them against the deployment platform used by your team. For broader architecture context, compare this checklist with the cloud-native application architecture checklist.
| Probe | Question | Failure consequence | What it should test |
|---|---|---|---|
| Liveness | Is the process fundamentally stuck or broken? | Restart or replace the instance | Internal ability to make progress; avoid fragile external dependencies |
| Readiness | Can this instance safely serve traffic or accept work? | Remove the instance from service temporarily | Required serving state, such as loaded configuration and usable dependencies |
| Startup | Has initial boot completed? | Delay normal liveness and readiness evaluation | One-time initialization, migrations, cache loading, or slow runtime startup |
Checklist by scenario
HTTP web service
- Create a small, unauthenticated probe route such as
/health/live,/health/ready, and, if needed, a startup route. Keep these routes separate from business APIs. - Make the liveness response depend primarily on the process itself. It can verify that essential in-memory components are responsive, but it should not fail merely because a remote database or third-party API is unavailable.
- Make the readiness response reflect whether the instance can serve its assigned traffic. Check only dependencies that are required for the service's normal request path, and define how degraded optional features should behave.
- Use a startup probe when initialization is legitimately slow or variable. Examples include loading a large model, warming a cache, applying a controlled initialization routine, or waiting for a framework to finish booting.
- Return a clear success status only after the relevant condition is true. Include a short diagnostic body for operators, but do not expose credentials, tokens, connection strings, or sensitive infrastructure details.
A conceptual HTTP implementation might look like this:
GET /health/live - 200 when the process can make progress
GET /health/ready - 200 when required serving dependencies are usable
GET /health/start - 200 after one-time initialization is complete
Keep response generation fast. A health endpoint that performs an expensive query or waits on several network calls can become a source of load during an incident.
Background worker or queue consumer
- Define what “alive” means for the worker: for example, the main loop is running, the process can renew its lease, and internal work queues are not permanently blocked.
- Define readiness around work acceptance. A worker may be alive but unready while it is draining, lacks required credentials, cannot reach the queue, or has exceeded a controlled concurrency limit.
- Do not report readiness solely because the process has started. A consumer that cannot acknowledge or safely process messages should not continue receiving work.
- For command-based probes, ensure the command observes application state rather than simply checking that a shell or process exists.
Workers often need an explicit drain or shutdown state. During deployment, readiness should fail before termination so that new work stops arriving while in-flight work is completed according to the service's delivery guarantees.
Slow-starting service
- Measure normal and worst-case startup time in the environments that matter, including cold starts and resource-constrained deployments.
- Allow enough startup-check attempts for legitimate initialization, with a small timeout appropriate to the endpoint.
- After startup succeeds, use liveness settings that detect genuine hangs rather than normal temporary pauses.
- Confirm that a failed startup eventually produces a useful deployment signal instead of leaving an unusable instance running indefinitely.
What to double-check
Failure thresholds and timing
Probe timing should reflect the application, not a copied manifest. Review the initial delay, check interval, timeout, and consecutive-failure threshold together. A short timeout with a low failure threshold may treat transient CPU pressure as a broken process. An excessively long interval can delay removal of a genuinely unhealthy instance.
Use different tolerance for different decisions. Readiness can usually change quickly because it controls traffic eligibility. Liveness should be more conservative because its failure may trigger a restart. Startup should cover the expected initialization window while still having a clear upper bound.
Dependencies and security
- List every dependency checked by readiness and explain why it is required.
- Decide whether a dependency outage should remove one instance, all instances, or none from service.
- Keep probe routes reachable by the platform without weakening authentication on business endpoints.
- Restrict response details to operationally useful information. Never return secrets or full exception traces.
- Verify that network policy, service mesh rules, TLS settings, and ingress configuration allow the probe to reach the intended port and path.
Probe failures are one signal, not a complete observability strategy. Pair them with structured logs, metrics, deployment events, and traces. When an API response is part of the investigation, a JSON API debugging workflow can help inspect and compare responses without confusing formatting issues with application failures.
Deployment behavior
Test the sequence, not only an individual endpoint. During a rollout, confirm that a new instance becomes ready before it receives normal traffic, that an unready instance is removed from service, and that a liveness failure has the intended restart behavior. Test graceful termination as well: readiness should stop new work before the process exits.
Common mistakes
- Using one endpoint for every purpose: A single deep health check often makes liveness too sensitive and readiness too vague.
- Checking every dependency from liveness: This can turn an external outage into repeated restarts, increasing pressure on the system.
- Declaring readiness at process start: The process may be listening while configuration, migrations, connections, or caches are still incomplete.
- Ignoring startup behavior: Slow initialization can look like a deadlock when no startup probe or equivalent grace period exists.
- Making probes expensive: Large queries, fan-out requests, and verbose diagnostics create avoidable work during failures.
- Testing only the happy path: Simulate a slow database, failed credentials, unavailable queue, overloaded process, and graceful shutdown.
- Changing thresholds without a reason: Record why a timing value changed and which deployment or incident evidence supports it.
When to revisit
Review health probe configuration before each new service deployment and whenever the service's startup path, dependency graph, traffic pattern, or runtime changes. Revisit it after an incident involving restart loops, premature routing, slow rollouts, queue duplication, or unexplained instance replacement. It is also worth including probe behavior in seasonal planning cycles, capacity reviews, autoscaling changes, and platform upgrades.
Use this short review before approving a change:
- Write the exact question each probe answers.
- Confirm that liveness failures represent a process problem, not an ordinary dependency outage.
- Confirm that readiness matches the work the instance is about to receive.
- Verify that startup timing covers real initialization without masking permanent failure.
- Run a rollout test with slow, failed, and recovering dependencies.
- Record the expected platform action for each failure and check the resulting logs and events.
Finally, recheck the health-probe fields, defaults, supported mechanisms, and framework integration whenever the orchestration platform or application runtime is upgraded. The goal is not to make every endpoint report “healthy”; it is to give the platform enough accurate information to route, restart, and replace instances safely.