Skip to content

Health Checks

StackBlaze only routes traffic to pods that pass health checks. A new deployment is not marked live until its readiness probe succeeds. If a running pod fails its liveness probe, Kubernetes restarts it automatically. This gives you zero-downtime deploys and automatic recovery from crashes.

Health probes Edge traffic only reaches replicas that pass readiness Readiness HTTP GET · every 10s 200-299 · in endpoints Fail or timeout edge stops sending traffic Liveness HTTP GET · every 15s stuck or deadlocked process 3 consecutive failures container is restarted Startup slow boot · grace up to 300s liveness is paused JVM warmup · ML models no premature restart during boot new deploy is not live until readiness succeeds · failed new pods keep old traffic

Health checks are configured per-service and run continuously throughout the pod’s lifetime. There are three probe types: readiness (is the pod ready for traffic?), liveness (is the pod still healthy?), and startup (for slow-starting services).

HTTP GET to your health check path. Returns 200–299 = pod is ready to receive traffic. Returns anything else or times out = pod is removed from the load balancer endpoints until it recovers. Checked every 10 seconds.

HTTP GET to your health check path. If the pod fails 3 consecutive liveness checks, Kubernetes kills and restarts the pod. Catches processes that are stuck or deadlocked but haven’t crashed. Checked every 15 seconds after startup.

Runs on pod start only. The liveness probe is paused until the startup probe succeeds. Configure a grace period of up to 300 seconds for services with slow initialization (JVM warmup, loading ML models, etc.).

server.js
const express = require('express');
const app = express();
// Minimal health check, always returns 200
app.get('/health', (req, res) => {
res.json({ status: 'ok', uptime: process.uptime() });
});
// Advanced: check DB before declaring ready
app.get('/health/ready', async (req, res) => {
try {
await db.query('SELECT 1');
res.json({ status: 'ready', db: 'connected' });
} catch {
res.status(503).json({ status: 'unhealthy', db: 'disconnected' });
}
});
main.py
from fastapi import FastAPI, HTTPException
from sqlalchemy import text
app = FastAPI()
@app.get("/health")
async def health_check():
try:
await db.execute(text("SELECT 1"))
return {"status": "ok"}
except Exception as e:
raise HTTPException(status_code=503, detail=str(e))
  1. Implement a /health endpoint

    Add a GET /health route to your application that returns HTTP 200. At minimum it can return an empty 200 response. Optionally include checks for database connectivity, cache availability, or any other critical dependencies your app relies on.

  2. Configure the health check path

    Go to Service → Settings → Health Check. The default path is /. Change it to match your endpoint (e.g. /health, /api/health, or /status). You can also configure the timeout (default 10s, max 60s) and initial delay for slow-starting services.

  3. Configure startup grace period if needed

    For services that take a long time to start (e.g. JVM services loading large datasets), set a startup probe grace period of up to 300 seconds. This prevents Kubernetes from killing a slow-starting pod before it has a chance to become ready.

  4. Monitor health check status

    Open Service → Overview to see the current health status of each replica. Green indicates passing, red indicates failing. Click on a failing replica to view its recent health check response bodies and identify what is causing the failure.