Introduction
Liveness and readiness in kubernetes are key features in Kubernetes that ensure your application is healthy and available. While checks help restart unhealthy containers, readiness checks ensure only ready pods receive traffic.
What Are Probes in Kubernetes?
In Kubernetes, both a probe is a diagnostic mechanism to check the status of a container running inside a Pod.
Kubernetes offers three types of probes:
-
Live probe – Is the container alive?
-
Readiness probe – Is the container ready to accept traffic?
-
Startup probe – Has the container started correctly? (introduced in Kubernetes v1.16)
What is a Liveness Probe?
It probe checks whether a container is still running. If this check fails continuously, Kubernetes will restart the container automatically.
Why is it important?
Sometimes, a container might appear to be running (from the OS point of view), but the application inside is deadlocked, stuck, or in an unrecoverable state. It probes catch such situations.
Behavior:
-
If the live probe fails, Kubernetes kills and restarts the container.
-
The container restart follows the pod’s restart Policy (usually
Alwaysin Deployments).

What is a Readiness Probe?
A readiness probe checks whether the container is ready to serve traffic. If the check fails, Kubernetes will temporarily remove the Pod from the Service endpoints, i.e., it won’t receive traffic.
Why is it important?
Your application may need time to:
-
Load data from disk or database
-
Warm-up caches
-
Connect to third-party services
If you route traffic too early, it may result in errors. Readiness probes delay traffic routing until your app is truly ready.
Behavior:
-
If the readiness probe fails, the Pod is marked as not ready
-
The container is not restarted
-
The Pod remains running, but doesn’t receive traffic from Services
Differences between liveness and readiness in kubernetes
| Feature | Liveness Probe | Readiness Probe |
|---|---|---|
| Purpose | Checks if the container is alive | Checks if the container is ready to serve traffic |
| Failure Action | Restarts the container | Removes the Pod from Service endpoints |
| Triggered By | Deadlocks, stuck threads | Initialization, temporary failures |
| Recovery | Requires restart | Automatically re-added when ready |
| Service Exposure | Does not affect service routing | Affects service load balancing |
Types of Probes in Liveness and readiness in kubernetes
All probes (liveness, readiness, startup) support the following types:
1. HTTP Probes
Make an HTTP GET request to a specified endpoint in the container.
2. TCP Socket Probes
Attempt to open a TCP connection to the container.
3. Exec Probes
Run a command inside the container. Exit code 0 is success.
Example
Explanation:
-
Kubernetes starts checking after 10 seconds
-
Every 5 seconds, it hits
/healthz -
Timeout is 2 seconds
-
After 3 failures, the container is restarted
Readiness Probe Example
Explanation:
-
Starts after 5 seconds
-
If
/readyfails even once, Pod is marked unready -
It won’t receive any traffic from the service
Real-World Use Cases
Microservices
In microservice architectures, readiness probes prevent routing traffic to a Pod that hasn’t connected to its database or messaging service yet.
Database Initialization
Some apps need to perform database migrations at startup. Readiness probes ensure they don’t serve traffic until that’s done.
Long-lived APIs
API servers might hang or deadlock. Live probes detect these and trigger restarts.
Conclusion
Liveness and readiness in kubernetes probes are essential for running resilient and self-healing Kubernetes applications. They offer a way to detect when containers are:
-
Alive and healthy
-
Ready to handle traffic (readiness)
By configuring these probes properly, you reduce downtime, prevent broken apps from receiving traffic, and ensure smoother rollouts and scaling operations.
Kubernetes, don’t miss our guide on Kubernetes the Hard Way.
For official documentation, check out the Kubernetes Probe Docs.
Want to understand Kubernetes architecture better? Read our detailed Beginner’s Guide to Kubernetes. click here