Kubernetes Probes: Liveness, Readiness and Startup

A
Author
07 Aug, 2026 1 min read 682 views

Probes tell Kubernetes about the health of each container. Configured well, they give you zero-downtime deploys and self-healing. Configured badly, they can restart healthy Pods in a loop and turn a small issue into an outage.

The three probes

  • Readiness - "can this Pod receive traffic right now?" If it fails, the Pod is removed from Service endpoints but not restarted.
  • Liveness - "is this process stuck beyond repair?" If it fails, the container is restarted.
  • Startup - "has the app finished starting?" Liveness and readiness checks wait until it succeeds, which protects slow-starting apps.
containers:
  - name: api
    image: ghcr.io/acme/api:1.4.2
    ports: [{ containerPort: 3000 }]
    startupProbe:
      httpGet: { path: /healthz/live, port: 3000 }
      periodSeconds: 5
      failureThreshold: 24        # up to 2 minutes to start
    readinessProbe:
      httpGet: { path: /healthz/ready, port: 3000 }
      periodSeconds: 5
      failureThreshold: 2
    livenessProbe:
      httpGet: { path: /healthz/live, port: 3000 }
      periodSeconds: 10
      failureThreshold: 3

What each endpoint should check

// Liveness: is the process itself OK? Keep it trivial.
app.get('/healthz/live', (req, res) => res.send('ok'));

// Readiness: can we do useful work? Check critical dependencies.
app.get('/healthz/ready', async (req, res) => {
  if (shuttingDown) return res.status(503).send('shutting down');
  try {
    await db.query('SELECT 1');
    res.send('ready');
  } catch {
    res.status(503).send('db unavailable');
  }
});

The most common mistake

Checking the database in the liveness probe. If the database has a hiccup, every Pod fails liveness and gets restarted at once, which makes recovery slower. Dependencies belong in readiness; liveness should only detect a stuck process.

Tips

  • Probe endpoints must be fast and must not require authentication.
  • During shutdown, fail readiness first so traffic drains before the process exits.
  • If your app can't get stuck in a way a restart would fix, you may not need a liveness probe at all.
Was this article helpful?

Comments

No comments yet. Have a question or a tip? Be the first to share it.

Leave a comment

Comments are reviewed before they appear.