Health Check Endpoints: Separate Liveness, Readiness, and Dependencies
A health check endpoint lets an application or operations platform determine whether a process responds and whether an instance should receive new traffic. Separate liveness from readiness, and decide what each result should trigger: restart, traffic routing, or an alert.
A health check endpoint lets an application or operations platform determine whether a process responds and whether an instance should receive new traffic. Separate liveness from readiness, and decide what each result should trigger: restart, traffic routing, or an alert.
Separate the questions
A liveness check asks whether the process can keep responding. In Kubernetes, repeated failures can restart a container, so this check normally should not depend on a remote database or external API. Restarting every instance during a shared dependency outage can add reconnection load and worsen the incident.
A readiness check asks whether an instance can serve traffic now. If initialization is incomplete or a required dependency prevents request handling, report not ready so the router can stop sending it traffic. Check only dependencies required by real request paths; treating optional features as mandatory can remove every instance during a minor outage.
A startup check gives slow initialization time. In Kubernetes, liveness and readiness checks wait until the startup probe succeeds. Other platforms may use different terms and actions.
Keep checks bounded and safe
Use paths and success codes that match the platform contract. One documented example returns 200 for liveness and 503 when a required readiness check fails, but products differ; verify accepted codes and timeouts.
Checks should be fast, bounded, and safe to repeat. Full database queries, expensive integrations, or many downstream calls can create load or exceed probe timeouts. If a dependency check is needed, use a lightweight required operation with a short timeout. Keep detailed diagnostics behind authentication and access controls; public responses should not expose internal hosts, account details, stack traces, or secrets.
Configure and verify Kubernetes probes
For Kubernetes, match startup, liveness, and readiness probes to their intended roles. An HTTP probe sends GET to a configured path and port; success is a status from 200 through 399. Set timeoutSeconds, periodSeconds, and failureThreshold for startup and transient-delay behavior. Aggressive intervals can mistake temporary latency for failure.
After deployment, check:
kubectl get pods for READY counts and restart counts.
kubectl describe pod <pod-name> for probe events and recent state.
EndpointSlice membership to see whether an unready Pod was removed from Service traffic.
The endpoint’s status and response time directly, then compare external availability checks with application logs and metrics.
On readiness failure, check initialization, which dependencies are truly required, and whether response codes and timeouts match platform settings. Repeated liveness restarts call for separating dependency checks from liveness and reviewing probe cost and thresholds. Confirm Pods become Ready again and recover traffic after the cause is fixed; keep a rollback path.
Combine internal and external monitoring
An in-process probe measures health from the instance’s perspective. An external availability check tests whether users can reach the URL through DNS, TLS, routing, and platform boundaries. These answer different questions: a passing internal check does not prove external reachability.
Health endpoints complement logs, error rates, latency, and resource metrics. Alerts should consider failure duration, affected instances, and user request outcomes. A failed check is a signal to act, not an automatic explanation of root cause.
References
[Microsoft Learn: Health Endpoint Monitoring pattern](https://learn.microsoft.com/en-us/azure/architecture/patterns/health-endpoint-monitoring)
[Kubernetes: Liveness, Readiness, and Startup Probes](https://kubernetes.io/docs/concepts/workloads/pods/probes/)
[Kubernetes: Configure Liveness, Readiness and Startup Probes](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/)