Liveness, Readiness and Startup Probes
An application that takes 40 seconds to start and a liveness probe that gives up after 15 will never run: the probe kills it mid-boot, forever. The usual fix is to inflate initialDelaySeconds, which makes real failures take just as long to detect. startupProbe is the right answer, and this shows both the failure and the fix on the same application.
Observability and Maintenance Guide 40 of 44 Intermediate
- Kubernetes1.36.4
- Cluster4 nodes
- Runtimecontainerd 2.2.6
- CNICalico v3.32.1
- TimeAbout 15 min
While a startupProbe is defined and has not yet succeeded, the liveness and readiness probes are disabled entirely. Once it succeeds it never runs again and the other two take over. That handover is the whole feature: slow start-up and fast failure detection stop being a trade-off.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| CKA1001 | 192.168.0.175 | Ubuntu 26.04 LTS | Control Plane Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE01 | 192.168.0.176 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE02 | 192.168.0.177 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE03 | 192.168.0.178 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when an application that needs time to start is being killed before it gets there. This matters because a liveness probe gives up on a fixed schedule, and a startup probe exists precisely to hold it off until the app is up.
- running an application that takes forty seconds, and watching liveness kill it
- adding a startup probe to the identical container and watching it come up cleanly
- doing the arithmetic - failureThreshold times periodSeconds is the budget you actually get
Before you start
- A cluster and kubectl.
- The session creates namespace
ckad-startwith a Pod whose container sleeps 40 seconds before starting nginx - once with only a liveness probe, once with a startup probe as well.
-
An application that takes 40 seconds
-
The same application with a startup probe
-
The arithmetic that matters