

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 10
click for more info
Not enough gems
Cost: 6 gems
1: Liveness Probes
incomplete
2: Readiness Probes
incomplete
3: Startup Probes
incomplete
4: Broken Cluster
incomplete
This lesson's interactive features are locked, please to keep using them
Because Kubernetes is all about building self-healing systems, it automatically restarts a container when it crashes.
But what if the app doesn't actually crash? A program can get stuck in a deadlock or an infinite loop, or just stop responding. Sure, technically the process is still running, so Kubernetes won't restart it, but the app is effectively dead.
A liveness probe fixes that. The kubelet periodically checks on the container, and if the check fails too many times in a row, it restarts the container.
The most common probe is a simple HTTP request. Most web servers have an endpoint just for this, conventionally at /healthz, that returns a 200 OK status code if the server has started up successfully and is listening for traffic. SynergyChat's API has one:
containers:
- name: synergychat-api
image: bootdotdev/synergychat-api:latest
livenessProbe:
httpGet:
path: /healthz
port: 8080
periodSeconds: 5
failureThreshold: 3httpGet: Send a GET request to this path and port. Any status code from 200 to 399 is a success.
periodSeconds: How often to check, in seconds (default 10)
failureThreshold: How many failures in a row before Kubernetes restarts the container (default 3)
Add a liveness probe to the API, then break it on purpose.
Submit the shell checks.