Skip to main content

Overview

Health check endpoints provide real-time service health status for monitoring, load balancers, and orchestration systems. Designed for Kubernetes, Cloud Run, and other cloud platforms.

Endpoints

GET /health

Primary health check - Returns overall service health. Use this endpoint for:
  • Load balancer health checks
  • Monitoring systems
  • General health status
Request Example:
Response (Healthy):
Response (Degraded):
Response (Unhealthy):
Status Codes:
OK
Service is healthy (all checks passed)
Service Unavailable
Service is degraded or unhealthy (one or more checks failed)

GET /health/ready

Readiness probe - Indicates if service is ready to accept traffic. Use this endpoint for:
  • Kubernetes readiness probes
  • Load balancer registration
  • Traffic routing decisions
Returns 200 only when all critical dependencies are available. Service may be running but not ready.
Request Example:
Response (Ready):
Response (Not Ready):
Status Codes:
OK
Service is ready to accept traffic
Service Unavailable
Service is not ready (dependencies unavailable)
Kubernetes Configuration:

GET /health/live

Liveness probe - Indicates if service is alive and not deadlocked. Use this endpoint for:
  • Kubernetes liveness probes
  • Auto-restart decisions
  • Deadlock detection
Failing liveness checks triggers pod restarts. Only use for detecting unrecoverable failures.
Request Example:
Response (Alive):
Response (Not Alive):
Status Codes:
OK
Service is alive and responsive
Service Unavailable
Service is deadlocked or unresponsive
Kubernetes Configuration:

GET /health/startup

Startup probe - Indicates if service has completed initialization. Use this endpoint for:
  • Kubernetes startup probes
  • Slow-starting applications
  • Initial dependency checks
Prevents premature liveness/readiness checks during startup. Useful for services with long initialization.
Request Example:
Response (Started):
Response (Starting):
Status Codes:
OK
Service has completed startup
Service Unavailable
Service is still starting up
Kubernetes Configuration:

GET /health/dependencies

Detailed dependency status - Shows health of all external dependencies. Use this endpoint for:
  • Debugging connectivity issues
  • Monitoring dashboards
  • Operational visibility
Request Example:
Response:
Status Codes:
OK
Dependency check completed (may include unhealthy dependencies)

Health Check Responses

Status Values

string
Component is functioning normally
string
Component is operational but with reduced performance
string
Component is not functioning
string
Component status cannot be determined

Component Checks

Checks:
  • API key validity
  • Model availability
  • Response time < 5s
  • Quota availability
Failure Scenarios:
  • Invalid API key
  • Quota exceeded
  • Connection timeout
  • Model not found

Monitoring Integration

Prometheus

Expose health check metrics:
Example Alerts:

Kubernetes

Complete Probe Configuration:

Cloud Run


Debugging Health Issues


Best Practices

Startup Probe:
  • Use for slow-starting services (>30s initialization)
  • Set failureThreshold to allow sufficient startup time
  • Disable liveness/readiness until startup succeeds
Liveness Probe:
  • Check only critical functionality
  • Avoid checking external dependencies (may cause cascade failures)
  • Set generous timeouts to avoid false positives
  • Use longer periodSeconds (10-30s) to reduce load
Readiness Probe:
  • Check all critical dependencies
  • Use short periodSeconds (5-10s) for fast traffic routing
  • Allow temporary failures (set appropriate failureThreshold)
  • Monitor health check response times
  • Alert on sustained unhealthy status
  • Track dependency availability
  • Set up dashboards for health metrics
  • Use different alert severities (critical vs warning)
  • Use /health/ready for load balancer health checks
  • Set appropriate check intervals (5-30s)
  • Configure healthy/unhealthy thresholds
  • Enable connection draining on unhealthy instances

Kubernetes Deployment

Configure health probes

Monitoring Guide

Set up observability

Troubleshooting

Debug health issues

Production Checklist

Health check requirements

Always Available: Comprehensive health checks ensure your service is monitored and reliable!