Course contentsShow
← Cloud and Infrastructure
Lesson 1420 of 2,98929. Kubernetes ObservabilityFree lesson

Liveness Probes Fundamentals

Learn how liveness probes detect and restart unhealthy containers automatically.

Liveness Probes Fundamentals

You'll learn: How liveness probes automatically detect and restart containers that are stuck or unresponsive, keeping your applications healthy.

What Are Liveness Probes?

A liveness probe is Kubernetes' way of asking your container, "Are you still alive and functioning?" Think of it like a wellness check at a doctor's office—if your heart stops beating, action is needed immediately.

Sometimes containers don't crash completely but enter a broken state: a web server might stop responding to requests, or an application might deadlock internally. The process is still running (so Kubernetes thinks everything is fine), but the container can't do useful work anymore.

How Liveness Probes Work

You configure a liveness probe that Kubernetes runs periodically against your container. If the probe fails multiple times in a row, Kubernetes assumes the container is unhealthy and automatically restarts it. This gives your application a fresh start, often resolving transient issues.

The probe can check health in several ways:

  • HTTP requests - Does a GET request return success?
  • TCP connections - Can we establish a TCP socket?
  • Command execution - Does a command inside the container exit successfully?

Kubernetes will keep checking at regular intervals throughout the container's lifetime. If checks consistently fail, the restart mechanism kicks in—no human intervention required.

When to Use Liveness Probes

Use liveness probes when your application might hang, deadlock, or enter unrecoverable states where a restart is the best solution. They're your safety net against "zombie" containers.

Key Takeaway: Liveness probes monitor container health continuously and trigger automatic restarts when containers become unresponsive, ensuring self-healing applications without manual intervention.