Skip to content

Health probes and lifecycle management

A node answers three probes, and each answers a different question: has the node ever converged with the control plane, may it take work now, and is the process alive. Behind them sits one phase machine with three states, fed by what the cycle observed.

This page covers the phase machine, the probe endpoints and their conditions, and the reasons each probe reports.

The phase machine

flowchart LR
  W["WARMING<br/>bootstrap in progress"]
  A["ACTIVE<br/>ready for pull"]
  D["DRAINING<br/>intake paused,<br/>in-flight work continues"]
  W -->|"bootstrap complete,<br/>no drain signal"| A
  W -->|"bootstrap complete,<br/>drain signal"| D
  A -->|"drain requested, queue backpressure,<br/>or governor backpressure"| D
  D -->|"signal cleared, queue empty,<br/>no active runtimes"| A

WARMING is the state a process starts in. The drain signal is any of three conditions, so DRAINING covers an operator drain and a node under pressure alike. The transition back to ACTIVE needs the queue empty and no active runtimes, so a node does not declare itself ready while finishing work.

The machine observes five values each cycle:

bootstrap_complete        the node has registered and converged
governor_backpressure     the performance governor is holding work back
queue_backpressure_active the local queue is at its limit
queue_depth               how much is waiting
runtime_active_count      how many project runtimes are active

The three endpoints

The probe server listens on port 8091 and answers 200 when the probe holds and 503 when it does not. Each response carries the probe's own verdict and the whole probe state document.

Endpoint Holds when Reported reasons
/healthz/startup The node has converged at least once bootstrap_handshake_ready, bootstrap_handshake_converged, bootstrap_handshake_pending
/healthz/ready The node may take work now ready_for_pull, draining, bootstrap_register_pending, degraded_cp_unreachable, heartbeat_unconfirmed, or the health phase's own reason
/healthz/live The process is running process_alive

/healthz returns the whole document without a verdict. The aliases /startupz, /readyz and /livez answer the same three probes.

What each probe is gated on

Startup holds once the node has registered, its heartbeat is confirmed and its transport is active. That combination is recorded the first time it occurs, so startup keeps holding afterwards even while readiness comes and goes, and a control-plane outage leaves a converged node's startup probe green.

Readiness needs the same three conditions in the present, plus a health status of ready, plus no shutdown request. Any one of them failing makes the node unready and names the reason:

{
  "ok": false,
  "reason": "degraded_cp_unreachable",
  "probe_state": {
    "contract_version": "xratud.probe_state.v1",
    "startup": { "ok": true, "reason": "bootstrap_handshake_converged" },
    "readiness": { "ok": false, "reason": "degraded_cp_unreachable" },
    "liveness": { "ok": true, "reason": "process_alive" },
    "details": {
      "registered": true,
      "heartbeat_ok": false,
      "cp_transport_mode": "degraded_cp_unreachable",
      "cp_transport_retry_in_seconds": 2.0,
      "health_status": "draining",
      "health_reason": "queue_backpressure",
      "shutdown_requested": false
    }
  }
}

Liveness is the process answering at all. It reports process_alive whenever the server can respond, so a node that is unready for an hour keeps running.

Why the three are separated

If the node is Startup Readiness Liveness
Still bootstrapping Pending Unready Alive
Converged and working Holds Ready Alive
Converged, control plane unreachable Holds Unready Alive
Draining Holds Unready Alive
Stopped responding Fails Fails Fails

Only the last row is a reason to restart a node, and the three middle rows are states a node passes through. Liveness is gated on the process alone, so a control-plane outage leaves every node running.

The shipped template sets the thresholds to match: the startup probe allows ten minutes of failures, readiness one minute, and liveness two minutes after a thirty second delay.