Build · shipped

30 Days of Kubernetes (CKAD) — Day 04: Liveness, Readiness, and Startup Probes

Day 04 of the 30-day CKAD hands-on series: wiring honest health checks so Kubernetes routes traffic safely and self-heals deadlocked apps.

kubelet uses Probes to know when a container is ready for traffic and whether it is still alive.


1. The Three Probes

Probe When it fails Purpose
Readiness Pod is removed from Service Endpoints Prevents sending user traffic during warmup or overload
Liveness kubelet kills and restarts the container Recovers from deadlocks / hung processes
Startup Blocks Liveness & Readiness until it succeeds Protects slow-booting apps (e.g., JVM) from premature liveness kills

2. Probe Mechanisms

  1. httpGet: Checks HTTP status code 200–399 on a path & port.
  2. tcpSocket: Checks if a TCP handshake succeeds on a port.
  3. exec: Runs a command inside the container; exit code 0 means healthy.

3. Hands-On Lab: Day 04

In labs/k8s-30-days/day-04/:

  1. Create namespace ckad-day04.
  2. Deploy Pod probed-nginx (nginx:1.27-alpine) with:
    • readinessProbe: httpGet / on port 80 (initialDelaySeconds: 3, periodSeconds: 5).
    • livenessProbe: tcpSocket on port 80 (initialDelaySeconds: 5, periodSeconds: 10).
  3. Verify with ./labs/k8s-30-days/day-04/verify.sh.

Search DivineForge