This sample demonstrates Xavier's health check endpoints for Kubernetes/Docker orchestration.
- Liveness endpoint (
/health) - Readiness endpoint (
/ready) - Custom health checks
- Health check tagging for readiness
- Detailed health information in responses
| Endpoint | Purpose | When to use |
|---|---|---|
/health (Liveness) |
Is the process running? | Kubernetes restarts if unhealthy |
/ready (Readiness) |
Can it serve traffic? | Kubernetes routes traffic only when ready |
- Liveness (
/health): Always returns healthy if app is running (no checks) - Readiness (
/ready): Runs checks tagged with "ready"
dotnet runcurl http://localhost:5000/healthReturns 200 OK if the application is running.
curl http://localhost:5000/readyReturns 200 OK if all readiness checks pass.
With IncludeDetails = true, responses include JSON details:
{
"status": "Healthy",
"results": {
"database": {
"status": "Healthy",
"description": "Database connection is healthy"
},
"external-api": {
"status": "Healthy",
"description": "External API is reachable"
}
}
}builder.Services.AddHealthChecks()
.AddCheck<MyHealthCheck>("my-check", tags: new[] { "ready" });Health checks tagged with "ready" are included in the readiness probe.
apiVersion: v1
kind: Pod
spec:
containers:
- name: myapp
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: 80
initialDelaySeconds: 5
periodSeconds: 10{
"Xavier": {
"Health": {
"Enabled": true,
"LivenessPath": "/health",
"ReadinessPath": "/ready",
"IncludeDetails": true,
"ReadinessTags": ["ready"]
}
}
}- Liveness endpoint runs NO checks (always healthy if app responds)
- Readiness endpoint only runs checks tagged with specified tags
- Set
IncludeDetails = falsein production for security