Founding prices until 15 December: 30% off Pro, locked for life. See pricing

$ … Liveness probe failed ... Container will be restarted

Liveness probe failed: container keeps restarting

The kubelet restarts a container whose liveness probe fails, often before a slow app has started.

Kubernetes

What it means

When the liveness probe fails failureThreshold times in a row, the kubelet kills and restarts the container. With a slow-starting app, this kills it every time before it's ready, which ends in CrashLoopBackOff.

Causes and fixes

Most likely first. Run the check, and if it matches, apply the fix.

1. The app takes longer to start than the probe allows

Check:

kubectl describe pod <pod> | grep -i -A2 liveness

Fix: Add a startupProbe that allows the start-up time; liveness only begins after it passes.

2. The liveness check depends on a database or another service

Check:

kubectl get pod <pod> -o yaml | grep -A6 livenessProbe

Fix: Liveness should only answer "is this process stuck?"; move dependency checks to readiness.

Fix it yourself

A live machine in your browser with this problem already on it. The grader checks the result.

Open the lab

No account needed for your first tries.

Related errors