All templates
Sequence template

Container health check sequence

Orchestrator probes containers, handles failures and restarts.

Every production container orchestrator — Kubernetes, Docker Swarm, ECS — runs periodic health checks to keep broken containers from silently failing. This template shows what happens during that probe: the orchestrator sends a request to the container, the application responds with its health status, and if the check fails repeatedly, the orchestrator kills the container and starts a new one.

The loop captures the rhythm of production: probes run every 10 seconds, failure counts accumulate, and after a threshold (typically 3 consecutive failures), the orchestrator acts. The alt block shows the critical divergence: healthy containers cycle forever in the loop; unhealthy ones get replaced. This is the pattern behind 99.99% SLA uptime — the orchestrator acting faster than any human can detect and fix the problem.

When to use this template

  • Kubernetes and container debugging — a developer seeing "CrashLoopBackOff" can trace it back to failed health checks and adjust liveness/readiness probe configuration (timeout, threshold, period).
  • Explaining reliability to non-SREs — show how the orchestrator detects a dead application and automatically recovers, without any human intervention.
  • Designing health-check strategies — use this to decide what to probe (the critical path), how often (10s default is too aggressive for slow apps), and what triggers a restart vs. a gradual drain.

How to adapt it

Replace the health endpoint with your real dependency chain — if your app talks to a database and cache before responding, include those in the probe path:

  • Change GET /health to probe multiple systemsGET /health/db to check database connectivity, then GET /health/cache for cache, building toward a composite health status.
  • Add warm-up grace periods (initialDelaySeconds in Kubernetes) as an explicit delay before probes start, so slow-starting apps don't restart while loading.
  • Insert readiness vs. liveness branches — readiness probes tell the load balancer "I'm ready for traffic", while liveness probes ask "am I still alive?" — adapt the diagram to show both paths if your app uses both.

Visual edits regenerate clean Mermaid code, so you can sketch out your actual probe logic and export it straight into your Kubernetes manifests or health-check documentation.

Mermaid code

Copy it anywhere Mermaid is supported — GitHub, Notion, or your docs.

sequenceDiagram
    participant Orchestrator as K8s Orchestrator
    participant Container
    participant App as Application
    participant Probe as Health Endpoint

    loop Every 10 seconds
        Orchestrator->>Container: Execute liveness probe
        Container->>App: Fork probe process
        App->>Probe: GET /health
        Probe-->>App: 200 OK + status
        App-->>Container: Probe exit code 0
        Container-->>Orchestrator: Success
    end

    alt Probe fails (exit code 1)
        Orchestrator->>Orchestrator: Increment failure count
        Orchestrator->>Orchestrator: Check restart policy
        Orchestrator->>Container: Kill container
        Orchestrator->>Container: Start replacement
        Container-->>Orchestrator: New pod running
    end

Related templates