Tuning probe thresholds and timeouts

Wiring the endpoints is the easy half. The hard half is choosing intervals and failure counts that match how your service actually behaves under load. Aggressive thresholds turn a slow LLM provider into a restart loop. Loose thresholds keep dead pods around long enough to break user experience.

k8s/deployment.yaml
yaml
livenessProbe:
  httpGet:
    path: /health/live
    port: 8000
  initialDelaySeconds: 15
  periodSeconds: 20
  timeoutSeconds: 2
  failureThreshold: 3
readinessProbe:
  httpGet:
    path: /health/ready
    port: 8000
  initialDelaySeconds: 5
  periodSeconds: 10
  timeoutSeconds: 3
  failureThreshold: 2

Sensible defaults for an LLM-backed FastAPI service. Liveness gives the process room to start, readiness fails fast on a flaky dependency.

Quiz: Quiz

Loading practice…