Skip to main content
Running workloadsLesson 1 of 14

Health checks — alive, and ready for requests?

A running container does not guarantee that the application works. Here we follow what the kubelet asks with three periodic checks (probes), and what it does with each answer. How a dead container comes back is covered in When a Pod Dies (Self-Healing).

web-b READY0/1
Pods taking requests1 (web-a)
web-b restarts0
Worker nodeUsersends requestsServicespreads requestsEndpointsReady pod listweb-aexistingweb-bnew podRunningkubeletruns probesrequest
RequestResponse / report

What you will learn

  • Why Running and Ready are different
  • Why the startup probe holds back the other probes
  • A readiness failure removes the pod from the list, not restarts it
  • A liveness failure restarts the container
  • Two ways a bad probe setup causes restart loops

Probe mistakes and their results​

ProbeCommon mistakeResultFix
livenessAlso checks the DB connectionWhen the DB slows briefly, all pods restart at onceCheck only that the process is alive
livenessInitial delay shorter than startup timeRestarts before ready, ending in CrashLoopBackOffAdd a startup probe or raise the delay
readinessNot set at allRequests reach new pods before they are ready, causing errors on every updateExpose an endpoint that reports readiness
readinessAlways returns successTakes requests even when a dependency is down, returning errors to usersCheck needed dependencies here
startupMissing on a slow-starting appLiveness fails first and restarts it mid-startAllow the maximum startup time

Try it yourself​

kubectl get pods # READY (readiness) vs RESTARTS (liveness)
kubectl describe pod <pod> # Liveness/Readiness/Startup settings
kubectl get events --field-selector reason=Unhealthy # Probe failed messages
kubectl get endpointslices -l kubernetes.io/service-name=<service> # Is the pod in the list?

Check yourself

  1. kubectl get pods shows a pod with READY 0/1, but its RESTARTS count stays the same. Which probe is failing?
  2. The liveness probe also checks the DB connection, and the DB slows down briefly. What happens?
  3. An app needs about a minute to start, there is no startup probe, and liveness checks from 10 seconds. It ends in CrashLoopBackOff. What is the fix?

Further reading: Configure liveness, readiness and startup probes · Pod lifecycle — container probes · When a Pod Dies (Self-Healing) · How a Request Reaches a Pod