Skip to content

Kubernetes liveness, readiness, and startup probes explained

Liveness, readiness, and startup probes each make the kubelet do something different. Learn what each triggers and how to configure timing so probes stop causing restart storms.

Kubernetes gives you three probes and they are not interchangeable. A liveness probe decides whether the kubelet should restart a container. A readiness probe decides whether the Pod should receive traffic from a Service. A startup probe decides whether the app has finished booting, and while it runs it holds the other two back. Mixing these up is the single most common way a healthy-but-slow application ends up in a restart loop, or a Pod keeps taking traffic it can no longer serve. This guide covers what the kubelet actually does for each probe, the four handler types, every timing field, and how to set those fields so the probes help instead of hurt.

What you’ll accomplish

  • Tell liveness, readiness, and startup probes apart by the action each one triggers in the kubelet.
  • Write each probe with the right handler (httpGet, tcpSocket, exec, or grpc) and the right timing.
  • Understand every timing field: initialDelaySeconds, periodSeconds, timeoutSeconds, successThreshold, and failureThreshold.
  • Prove that readiness gates traffic and liveness restarts a container, using kubectl describe and kubectl get endpoints.
  • Avoid the classic misconfigurations that turn probes into restart storms and cascading outages.

Prerequisites

  • A running Kubernetes cluster, 1.29 or newer (kubectl version). Startup probes are stable well before this; nothing here needs a preview feature.
  • kubectl configured with permission to get, apply, and describe Deployments, Pods, and Endpoints in your namespace.
  • A Deployment you can add probes to. The examples use a small web app in namespace demo; substitute your own.

How it works

The kubelet on each node runs the probes for every container it manages. It does not ask the API server what to do — it acts locally, on a schedule you define, and each probe maps to a distinct action.

  • Liveness answers “is this container still working?” On repeated failure the kubelet kills and restarts the container, incrementing its restart count. This is for deadlocks — states an app cannot recover from on its own but a restart clears.
  • Readiness answers “can this Pod serve requests right now?” On failure the kubelet removes the Pod’s IP from the Service endpoints, so it stops receiving traffic — but it does not restart anything. When the probe passes again, the Pod is added back. This is for temporary unavailability: warming a cache, waiting on a dependency, draining before shutdown.
  • Startup answers “has the app finished starting?” Until it first succeeds, the kubelet does not run the liveness or readiness probes at all. This exists for slow starters — an app that needs 90 seconds to load can’t be protected by a liveness probe with a short delay, because the probe would kill it mid-boot. The startup probe gives it a long runway, then hands off.

Three probes and the distinct kubelet action each one triggers

The gating relationship is the part people miss. A liveness probe with initialDelaySeconds: 5 on an app that takes a minute to boot will restart the container before it ever comes up — a restart storm caused entirely by monitoring. The correct fix is a startup probe with a generous failureThreshold, after which liveness takes over with tight timing.

Timeline showing startup gating readiness and liveness until it first succeeds

Step-by-step

Pick a handler. All three probes support the same four handlers:

  • httpGet — the kubelet sends an HTTP GET to a path and port. Any 2xx or 3xx status is a success. This is the default choice for web apps.
  • tcpSocket — the kubelet opens a TCP connection to a port. Success means the connection was accepted. Use it for non-HTTP services like a database or message broker.
  • exec — the kubelet runs a command inside the container. Exit code 0 is a success. Powerful, but it forks a process on every check, so it is the most expensive handler.
  • grpc — the kubelet calls the standard gRPC health checking service on a port. Use it for gRPC services that implement the health protocol.

Add a readiness probe first. It is the safest probe to start with because failing it never restarts anything. This one checks an HTTP endpoint that returns 200 only when the app can serve requests:

readinessProbe:
  httpGet:
    path: /readyz
    port: 8080
  periodSeconds: 5
  timeoutSeconds: 2
  successThreshold: 1
  failureThreshold: 3

Add a liveness probe with conservative timing. Liveness should check something shallow — that the process is responsive — never a deep dependency. Keep it lightweight and forgiving so a brief hiccup does not trigger a restart:

livenessProbe:
  httpGet:
    path: /healthz
    port: 8080
  periodSeconds: 10
  timeoutSeconds: 2
  successThreshold: 1
  failureThreshold: 3

Add a startup probe for anything slow to boot. Give it a large failureThreshold multiplied by periodSeconds to define the total boot budget. Here that is 30 × 5 = 150 seconds before the kubelet gives up and restarts:

startupProbe:
  httpGet:
    path: /healthz
    port: 8080
  periodSeconds: 5
  timeoutSeconds: 2
  failureThreshold: 30

Understand every timing field. These are the only timing fields probes accept, and they mean exactly this:

  • initialDelaySeconds (default 0) — how long the kubelet waits after the container starts before the first probe. With a startup probe present, you usually leave liveness and readiness at 0 and let the startup probe own the delay.
  • periodSeconds (default 10) — how often the probe runs.
  • timeoutSeconds (default 1) — how long the kubelet waits for a response before counting the check as failed. The default of 1 second is aggressive; a loaded app can miss it.
  • successThreshold (default 1) — consecutive successes needed to flip from failing to passing. Must be 1 for liveness and startup probes.
  • failureThreshold (default 3) — consecutive failures before the kubelet acts (restart for liveness/startup, remove from endpoints for readiness).

Apply the Deployment and confirm the probes registered.

kubectl apply -f deployment.yaml
kubectl describe pod -n demo -l app=web

The describe output lists each probe with its handler and resolved timing, plus the restart count:

    Liveness:   http-get http://:8080/healthz delay=0s timeout=2s period=10s #success=1 #failure=3
    Readiness:  http-get http://:8080/readyz delay=0s timeout=2s period=5s #success=1 #failure=3
    Startup:    http-get http://:8080/healthz delay=0s timeout=2s period=5s #success=1 #failure=30
    Restart Count:  0

Validate it works

Confirm readiness gates traffic. With the Pod passing readiness, its IP appears in the Service endpoints:

kubectl get endpoints web -n demo
NAME   ENDPOINTS           AGE
web    10.244.1.7:8080     2m

Now make readiness fail without killing the app — for example, have /readyz return 503 on demand, or point the probe at a path that returns non-2xx. Within a few probe periods the endpoint disappears, but the container is untouched:

kubectl get endpoints web -n demo
NAME   ENDPOINTS   AGE
web    <none>      3m
kubectl get pod -n demo -l app=web
NAME                   READY   STATUS    RESTARTS   AGE
web-6d9c8b7f5c-abcde   0/1     Running   0          3m

Note READY 0/1 and RESTARTS 0 — readiness pulled it from the Service but did not restart it. That is exactly the difference between the two probes.

Confirm liveness restarts the container. Force a liveness failure — for example, make /healthz start returning 500, or kubectl exec in and stop the process the probe depends on. After failureThreshold consecutive failures the kubelet restarts the container and the count climbs:

kubectl get pod -n demo -l app=web -w
NAME                   READY   STATUS    RESTARTS      AGE
web-6d9c8b7f5c-abcde   1/1     Running   0             5m
web-6d9c8b7f5c-abcde   0/1     Running   1 (2s ago)    5m
kubectl describe pod -n demo -l app=web

The Events section names the cause directly:

  Warning  Unhealthy  12s   kubelet  Liveness probe failed: HTTP probe failed with statuscode: 500
  Normal   Killing    12s   kubelet  Container web failed liveness probe, will be restarted

Troubleshooting

  • Restart storm from an aggressive liveness probe. If RESTARTS climbs steadily and the Events show Liveness probe failed right after each start, the probe is killing the app during or just after boot. Either the app is slow to start (add a startup probe) or timeoutSeconds and failureThreshold are too tight for a loaded process. Widen them, and never make liveness depend on a slow code path.

  • Slow starter with no startup probe. An app that takes 60–120 seconds to become ready, protected only by a liveness probe, gets killed before it finishes and never recovers. This looks like CrashLoopBackOff but the container itself is fine. Add a startup probe sized to the real boot time (failureThreshold × periodSeconds), and see diagnosing CrashLoopBackOff in Kubernetes to confirm the exit code before you blame the probe.

  • Readiness probe checking a dependency causes a cascade. If /readyz returns non-2xx whenever the database is briefly slow, one slow dependency pulls every Pod out of the Service at once, and the whole service goes dark even though the app is running. Keep dependency checks out of readiness unless you truly want the Pod to stop taking traffic when that dependency is down — and even then, make the check tolerant.

  • timeoutSeconds too low. The default is 1 second. Under load, a healthy app can take longer than that to answer, so the probe records a failure that has nothing to do with health. Set timeoutSeconds: 2 or more and confirm with kubectl describe that the value took effect.

  • Expensive exec probes. An exec probe forks a process inside the container on every periodSeconds. A heavy script running every few seconds across hundreds of Pods adds real CPU load and can itself cause the timeouts it is meant to detect. Prefer httpGet or tcpSocket, and if you must use exec, keep the command cheap and the period modest.

  • Probe pointed at the wrong port or path. A port that does not match containerPort, or a path the app does not serve, fails every single probe: readiness never admits the Pod to the endpoints and liveness restarts it forever. kubectl describe pod prints the probe URL it is actually using — check that first, then confirm from inside the container with kubectl exec <pod> -n demo -- wget -qO- localhost:8080/healthz.

When this is the wrong approach

Probes manage a container’s participation in a Service and its restart lifecycle. They are not a substitute for fixing the underlying application.

  • A liveness probe does not fix a crashing app. If the process exits on its own, that is a crash to debug in the logs, not something to paper over with a restart trigger. Restarts hide the signal and reset the evidence.
  • Do not put deep dependency checks in liveness. A liveness probe that fails because a downstream database is down will restart a perfectly healthy container, achieving nothing except churn. Restarting your app does not fix someone else’s database.
  • Readiness is not a health dashboard. It answers one question — should this Pod receive traffic — and every check you add to it is a new way for traffic to be cut off. Keep it narrow.
  • When behavior differs only under production load or on one node, the probe timing tells you when the kubelet acted, not why the environment differs. That answer is in your metrics and the node, not in the probe spec.

The authoritative references are the official guide to configuring liveness, readiness, and startup probes and the Pod lifecycle documentation, which specifies probe behavior exactly. For the container-level equivalent, see Docker health checks.

If this is the kind of work you’d rather never own again, it’s the daily job of Managed Cloud Ops — book an infrastructure review.