Skip to main content
All of the catalog
Injectable fault

Liveness probe kills a healthy app

Since this morning's values update, go-api restarts every 40 seconds or so, and users get bursts of 503s between quiet spells. Every restart looks clean: the logs show the app starting, serving and shutting down on a signal, with no error. The app is not crashing on its own (no exit code 1) and is not being OOMKilled (no exit code 137).

WorkloadHigh severitygo-api/go-api
Definition on GitHub

Which app it breaks

go-api by default. Pass --app to break another app in your lab instead.

The hint ladder

Each hint narrows the search a little further. They are collapsed on purpose: open one only when you are properly stuck, because working out the next command yourself is the whole exercise.

Hint 1

The restarts are the place to start: kubectl get pods -n go-api shows RESTARTS climbing. Before you read any app logs, find out how the last container ended: kubectl describe pod -n go-api <pod> and read Last State, its Reason and Exit Code. Did the app exit on its own?

Hint 2

Exit code 0 and Reason: Completed mean the app shut down cleanly because it was told to: the logs end with it receiving a signal. When the kubelet restarts a container, it records why in the pod's events. Read the Events at the bottom of kubectl describe pod, or kubectl get events -n go-api --sort-by=.lastTimestamp.

Hint 3

The kubelet restarts a container when its liveness probe fails failureThreshold times in a row. Compare the probe in the Deployment (kubectl get deploy go-api -n go-api -o yaml, under livenessProbe) with the paths the app really serves. Its own logs show which path it answers 404 to, every ten seconds.

Further reading

Get updates

New scenarios and faults, release notes, and news about hosted labs if and when there is some. A few emails a month at most.

We'll email you about new releases, new lab content and paid offerings such as hosted labs, courses and workshops. Unsubscribe any time.