Kubernetes Liveness Probe Health Check

Design a Kubernetes liveness probe response that detects deadlocks and unrecoverable states. Failing liveness probes trigger container restarts.

Kubernetes

Detailed Explanation

Kubernetes Liveness Probe

The liveness probe tells Kubernetes whether your application is alive. If it fails, Kubernetes restarts the container. It should check for unrecoverable conditions only.

Response Format

{
  "status": "ok",
  "checks": {
    "deadlockDetection": { "status": "ok" },
    "memoryThreshold": {
      "status": "ok",
      "used": "256MB",
      "limit": "512MB"
    }
  }
}

Probe Configuration

livenessProbe:
  httpGet:
    path: /healthz
    port: 8080
  initialDelaySeconds: 15
  periodSeconds: 10
  timeoutSeconds: 5
  failureThreshold: 3

What to Check

Check Include? Why
Deadlocks Yes Unrecoverable without restart
Memory leaks Yes Process won't recover
Thread pool exhaustion Yes Needs restart
Database connectivity No Temporary, will recover
External API No Not your app's fault

Critical Rule

Never include dependency checks in liveness probes. If your database goes down, your liveness probe should still pass. Otherwise, Kubernetes will restart all your pods, creating a cascade failure when the database recovers and all pods try to reconnect simultaneously.

Path Convention

The standard path for liveness probes is /healthz (the "z" suffix is a Kubernetes convention meaning "health").

Use Case

Kubernetes deployments where applications can get into deadlocked or unrecoverable states, requiring automatic container restarts to restore service functionality.

Try It — Health Check Endpoint Designer

Open full tool