Přeskočit obsah

Kontroly stavu

Endpointy stavu a Kubernetes sondy

Verze dokumentu: 1.0.0
Poslední aktualizace: 2026-02-10


1. Přehled endpointů stavu

Komponenta Endpoint Metoda Vyžadována autentizace
API Server /api/v1/health GET Ne
API Server /api/v1/health/database GET Ne
API Server /api/v1/health/system GET Bearer Token
OCSP Responder /health GET Ne
OCSP Responder /ready GET Ne
OCSP Responder /live GET Ne

2. Stav API Serveru

Základní kontrola stavu

GET /api/v1/health HTTP/1.1
Host: vault.example.com

Odpověď 200 OK:

{
  "status": "healthy",
  "version": "1.8.0",
  "components": {
    "database": "healthy",
    "redis": "healthy",
    "ocsp": "healthy"
  }
}

Odpověď 503 Service Unavailable:

{
  "status": "unhealthy",
  "version": "1.8.0",
  "components": {
    "database": "unhealthy",
    "redis": "healthy",
    "ocsp": "healthy"
  }
}

Stav databáze

GET /api/v1/health/database HTTP/1.1

Odpověď:

{
  "status": "healthy",
  "latency_ms": 2,
  "connections": {
    "active": 5,
    "idle": 10,
    "max": 100
  }
}

Stav systému (s autentizací)

GET /api/v1/health/system HTTP/1.1
Authorization: Bearer <admin-token>

Odpověď:

{
  "status": "healthy",
  "version": "1.8.0",
  "uptime_seconds": 864000,
  "components": {
    "database": {
      "status": "healthy",
      "latency_ms": 2
    },
    "redis": {
      "status": "healthy",
      "latency_ms": 1
    },
    "ocsp": {
      "status": "healthy",
      "latency_ms": 5
    },
    "license": {
      "status": "valid",
      "expires_at": "2027-02-10T00:00:00Z",
      "tier": "enterprise"
    }
  },
  "statistics": {
    "total_secrets": 1250,
    "total_certificates": 340,
    "active_agents": 15,
    "active_users": 42
  }
}

3. Stav OCSP Responderu

Sonda připravenosti

GET /ready HTTP/1.1

Vrací 200 OK, když je OCSP responder připraven zpracovávat požadavky (databáze připojena, podepisovací klíč načten).

Sonda živosti

GET /live HTTP/1.1

Vrací 200 OK, když je proces OCSP responderu aktivní. Tato sonda neověřuje připojení k databázi.

Úplný stav

GET /health HTTP/1.1

Odpověď:

{
  "status": "healthy",
  "components": {
    "database": "connected",
    "signing_key": "loaded",
    "ca_certificates": 2
  }
}

4. Konfigurace Kubernetes sond

Doporučené nastavení sond

# API Server
livenessProbe:
  httpGet:
    path: /api/v1/health
    port: 8080
  initialDelaySeconds: 30
  periodSeconds: 30
  failureThreshold: 3
  timeoutSeconds: 10

readinessProbe:
  httpGet:
    path: /api/v1/health
    port: 8080
  initialDelaySeconds: 10
  periodSeconds: 10
  failureThreshold: 3
  timeoutSeconds: 5

startupProbe:
  httpGet:
    path: /api/v1/health
    port: 8080
  initialDelaySeconds: 5
  periodSeconds: 5
  failureThreshold: 30
  timeoutSeconds: 5
# OCSP Responder
livenessProbe:
  httpGet:
    path: /live
    port: 8081
  periodSeconds: 30
  failureThreshold: 3

readinessProbe:
  httpGet:
    path: /ready
    port: 8081
  periodSeconds: 10
  failureThreshold: 3

5. Skript pro kontrolu stavu

Pro on-premise nasazení použijte tento skript pro automatizované ověření stavu:

#!/bin/bash
# mazevault-health-check.sh

BASE_URL="${MAZEVAULT_URL:-https://localhost}"

# Check API health
api_status=$(curl -sk "$BASE_URL/api/v1/health" -o /dev/null -w '%{http_code}')
if [ "$api_status" != "200" ]; then
  echo "CRITICAL: API Server unhealthy (HTTP $api_status)"
  exit 2
fi

# Check OCSP health
ocsp_status=$(curl -sk "$BASE_URL/ocsp/health" -o /dev/null -w '%{http_code}' 2>/dev/null)
if [ "$ocsp_status" != "200" ]; then
  echo "WARNING: OCSP Responder unhealthy (HTTP $ocsp_status)"
  exit 1
fi

echo "OK: All components healthy"
exit 0

Související