Python Readiness & Liveness Probes — ELI5
Imagine a school where the teacher does two different roll calls.
First roll call: “Are you alive?” The teacher walks around and checks if each student is awake and breathing. If someone is unconscious at their desk, the teacher calls the nurse. This is the liveness check. It answers: “Do we need to restart this student?”
Second roll call: “Are you ready to work?” The teacher checks if each student has their textbook open, their pencil sharpened, and their homework done. A student might be alive and well but completely unprepared — still searching for their notebook. This is the readiness check. It answers: “Should we give this student new assignments?”
Your Python app gets both roll calls too.
When your app runs in the cloud (like Kubernetes), the platform keeps asking these two questions:
“Are you alive?” — Can the app respond at all? If not, something is seriously wrong (maybe it’s frozen or stuck in an infinite loop), and the platform restarts it. Like the nurse reviving the unconscious student.
“Are you ready?” — Can the app handle real work? Maybe it just started and is still loading data. Maybe the database it needs is temporarily down. It’s alive, but not ready. The platform stops sending new traffic to it until it’s ready again. Like the teacher skipping the unprepared student for questions.
The key difference: failing a liveness check means “restart me.” Failing a readiness check means “stop sending me work until I recover.”
One thing to remember: Liveness asks “should this be restarted?” and readiness asks “should this receive traffic?” — they’re different questions with very different consequences.
See Also
- Python Ab Testing Framework How tech companies test two versions of something to see which one wins — explained with a lemonade stand experiment.
- Python Configuration Hierarchy How your Python app decides which settings to use — explained like layers of clothing on a cold day.
- Python Feature Flag Strategies How developers turn features on and off without redeploying — explained with a TV remote control analogy.
- Python Graceful Shutdown Why your Python app needs to say goodbye properly before it stops — explained with a restaurant closing analogy.
- Python Health Check Patterns Why your Python app needs regular check-ups — explained like a doctor's visit for software.