The Three Types of Probes
What you'll learn: How Kubernetes uses liveness, readiness, and startup probes to monitor and manage application health, and when to apply each type.
What Are Probes?
Building on the health check fundamentals from the previous lesson, Kubernetes provides three specialized probe types that serve distinct purposes in your Pod's lifecycle. Think of them as three different doctors: one checks if you're alive, one checks if you're ready to work, and one gives you extra time when you're just waking up.
Liveness Probes
Purpose: Detects when your application is stuck or deadlocked and needs a restart.
Liveness probes answer the question: "Is my container alive and functioning?" If a liveness probe fails repeatedly, Kubernetes kills and restarts the container. Use this when your application might hang or enter an unrecoverable state but the process itself doesn't crash.
Readiness Probes
Purpose: Determines if your container is ready to accept traffic.
Readiness probes answer: "Is my container prepared to serve requests?" When a readiness probe fails, Kubernetes removes the Pod from Service endpoints—traffic stops flowing, but the container keeps running. Use this during startup initialization, database connection establishment, or cache warming. The container stays alive but temporarily stops receiving requests.
Startup Probes
Purpose: Gives slow-starting containers extra time before other probes kick in.
Startup probes answer: "Has my container finished its initial boot sequence?" This probe runs first and disables liveness/readiness checks until it succeeds. Use this for legacy applications or containers with long initialization times (30+ seconds) to prevent premature restarts.
Choosing the Right Probe
- Liveness: Restart frozen applications
- Readiness: Control traffic flow during temporary unavailability
- Startup: Protect slow-starting containers from early termination
Key Takeaway: Use liveness probes to recover from deadlocks, readiness probes to manage traffic during runtime conditions, and startup probes to accommodate lengthy initialization—each serves a distinct monitoring purpose in your Pod's health management.