Startup, readiness and liveness probes answer different questions and should not share one failure rule.
Spring Boot Kubernetes probes: separate startup, readiness and liveness
The three decisions differ
A service takes time to warm a route cache. A startup probe can allow that initialization window without a premature restart. Readiness determines whether the pod should receive requests; liveness should report a locally unrecoverable state, not every temporary database outage. Boot Actuator exposes separate liveness and readiness health groups in Kubernetes. The availability model is already part of the application.
Budget timing from measurements
Set failure thresholds from cold-start and shutdown measurements, not a copied manifest. If readiness begins before the service can serve its promised request, traffic fails. If liveness includes a shared downstream dependency, a database outage can restart every replica at once. Termination readiness needs enough time for endpoints to stop routing new work.
Run a rollout failure drill
Start with a deliberately slow cache, disconnect the database, then roll out a new version. Confirm startup does not restart a healthy warming pod, readiness removes an unusable pod, and a downstream outage does not trigger a restart storm.
Implementation sketch
startupProbe:
httpGet: {path: /actuator/health/liveness, port: 8080}
periodSeconds: 5
failureThreshold: 24
readinessProbe:
httpGet: {path: /actuator/health/readiness, port: 8080}
periodSeconds: 5
livenessProbe:
httpGet: {path: /actuator/health/liveness, port: 8080}
periodSeconds: 10Cost and verification
Frequent probes add small HTTP work. Aggressive failure thresholds cost availability through needless restarts; generous thresholds delay detection of a truly broken pod.
Common Mistakes
- Do not include every external dependency in liveness.
- Do not copy startup timing without measuring the coldest deployment path.
- Do not probe a management port that is inaccessible to the kubelet.
Read next
Spring Boot liveness versus readiness: do not restart on every dependency outage, Spring readiness during termination: stop routing before stopping dependencies, Spring Cloud Kubernetes permissions: scope the service account to its reads.
