Infrastructure

Kubernetes: diagnose health probes before changing timeouts

A runbook for separating slow startup, liveness restarts and readiness failures, then validating a fix without hiding an outage.

28 Nov 2026 kubernetesaksobservabilitytroubleshootingrunbookrollbackproduction

After an AKS deployment, pods restart and available capacity drops. The team considers increasing every probe timeout. But the same symptom can result from slow initialization, a process exiting, memory exhaustion or a poorly designed health check. This fictional scenario also applies to other Kubernetes clusters.

The goal is to establish what is restarting the container, then fix the check or the application without sending traffic to an instance that cannot serve it.

Stabilize and preserve evidence

Pause promotion of the new revision and check actual available capacity, client errors and backlog. Preserve healthy capacity before intervening; do not delete every pod to start over. Record the cluster, namespace, Deployment, revision, image and affected pods, along with UTC timestamps and recent changes.

For an affected pod, compare kubectl -n <namespace> describe pod <pod> with kubectl -n <namespace> logs <pod> -c <container> --previous --timestamps. Capture probe events, restart count, last termination state, reason, exit code and application timeline. Events are temporary and previous logs may be unavailable or incomplete: missing evidence does not prove a probe succeeded. Protect logs and remove secrets and sensitive data.

Compare the effective pod manifest with the healthy revision as well: probe type, path or command, port, delays and thresholds. Check the right container and changes to configuration, resources or dependencies. An OOMKilled state or startup error needs its own investigation; do not blame liveness without a matching timeline.

Separate the three decisions

A startup probe protects initialization: readiness and liveness probes do not run until it succeeds. Repeated startup or liveness failures cause the kubelet to kill the container, which is then subject to its restart policy. A failed readiness probe marks the pod unready: it does not by itself restart the container and normally removes the pod from traffic through matching Services.

Match events to logs and configuration for the affected pod:

  • Startup fails before the application listens: measure initialization time and investigate the blocker rather than assuming the delay is normal.
  • Liveness fails after startup: check the path, port, response and duration; determine whether the process is actually stuck or a slow dependency makes the check fail.
  • Readiness fails without a restart: establish why the instance cannot serve, inspect Service endpoints and assess remaining capacity.
  • The process exits without evidence of a probe failure: investigate the exit code, memory, configuration and application logs before adjusting thresholds.

A liveness endpoint that depends on an unavailable database can trigger cascading restarts without repairing the database. Reserve liveness for failures a restart can reasonably fix; use readiness to decide whether the instance can receive traffic, according to the application’s contract. A shared dependency failure can make every instance unready, so plan explicitly for that outcome.

Test a bounded correction

In an isolated environment, reproduce the observed slow startup with a representative image and configuration. Check that the probed path and port match the container, then measure startup and response times under realistic load. Choose a documented margin; failureThreshold × periodSeconds is an approximate startup budget, not an exact guarantee, because delays, timeouts and scheduling also matter.

Test these cases separately: slow but valid startup, blocked initialization, a live process unable to serve, an unavailable dependency and a genuine hang recoverable by restart. Check Ready transitions, restarts, endpoints and client errors. Raising a threshold may reduce false positives but delay detection of a real failure; removing a probe also removes its protection.

Canary, decision and rollback

Keep the healthy revision and approved manifest. Before changing anything, name an owner, canary scope, observation window and stop thresholds. Deploy the correction to a controlled fraction, accounting for actual capacity and routing. Compare restarts, startup duration, endpoint availability, latency and business errors with the baseline. Confirm that a genuinely failed instance is still detected.

If checks pass and capacity remains sufficient, expand gradually. If restarts persist, traffic reaches unready instances or detection degrades, stop promotion and return to the approved revision using the normal deployment procedure. Verify pods, endpoints and the client journey after rollback; reverting a Deployment alone does not undo a data migration or external side effect. If the state remains uncertain, keep promotion paused.

References