A health check is a signal an application gives Kubernetes about whether it is functioning and ready to receive traffic. Kubernetes cannot infer these conditions for every service, so the application must expose a test that reports success or failure. section 4.0 section 4.1
Kubernetes uses two primary health-check roles:
- Liveness probes identify stuck or nonresponsive applications and allow Kubernetes to restart their containers. section 4.1 section 4.3
- Readiness probes identify replicas that can receive traffic. Kubernetes removes unready replicas from Service traffic, which helps prevent dropped requests during updates. section 4.1 section 4.3
- A failed probe can represent a timeout, excessive load, a stopped connection listener, or an unavailable critical dependency. section 4.1
Choosing a probe type
Expose an HTTP endpoint such as /healthz and return HTTP 200 when healthy. For a non-HTTP service such as SMTP, test whether a TCP connection opens. For a batch job without a service endpoint, run a Bash script whose nonzero exit code indicates failure. section 4.1.6
readinessProbe:
initialDelaySeconds: 15
periodSeconds: 30
tcpSocket: #1
port: 25 #1
successThreshold: 1
failureThreshold: 1
#1 TCP probe specification
A readinessProbe configuration can specify an initial delay, check interval, TCP port, and success or failure thresholds. section 4.1.6








