Core
Managed mode
Run a leader and its workers under an external manager — the environment contract, the watched files, and what survives a manager outage.
In short
Any program can manage opod: a control plane, a systemd unit you template, a CI job or a script. Core does not know which one runs it. A manager talks to core through four surfaces only:
- Process environment. Variables set when it starts a leader or worker. See Environment variables.
- Watched files. The plan, the auth snapshot and the policy snapshot, re-read every 10 seconds. No restart needed.
- The admin API
/admin/v1, with an admin key. The routes listed inGET /admin/v1/capabilitiesare the stable set. - Streams. Usage and lifecycle events, read by cursor. From core v0.4.0 usage is pushed instead: one OTLP log record per request to
OPOD_USAGE_OTLP_ENDPOINT(see Usage push); events are still read by cursor.
The request path stays inside core. A leader keeps serving from its last good files while the manager is down.
Run a leader and a worker under a manager
Write the three files
Write the plan, the auth snapshot and the policy snapshot where the leader will read them. A minimal plan names the one model:
mkdir -p /etc/opod /etc/opod-auth echo '{"revision":1,"model":{"id":"qwen2.5-7b-instruct"}}' > /etc/opod/plan.jsonThe formats are in Plan file, Auth snapshot and Policy snapshot. The auth and policy files may appear later.
Start a managed leader
export OPOD_MANAGED=1 export OPOD_ADMIN_TOKEN=sk-orc-<manager-admin-key> # the manager calls /admin/v1 with it export OPOD_JOIN_TOKEN=sk-orc-<node-token> # workers join with it export OPOD_PLAN_FILE=/etc/opod/plan.json export OPOD_AUTH_FILE=/etc/opod-auth/auth.json export OPOD_POLICY_FILE=/etc/opod-auth/policy.json opod up --no-wizardWhat
OPOD_MANAGED=1changes:- The store is in memory unless
OPOD_STORAGE_DSNnames a file. Keys come from the auth snapshot, nodes from heartbeats, and the manager pulls usage and events by cursor. From core v0.4.0 the manager setsOPOD_USAGE_OTLP_ENDPOINTandOPOD_USAGE_OTLP_HEADERSand receives usage instead of pulling it. - The banner's
Mode:line readsmanaged.
What the tokens do:
OPOD_ADMIN_TOKEN(auth.admin_token) is seeded as an admin key at every start. With it set, noadmin.keyfile is written.OPOD_JOIN_TOKEN(auth.join_token) is seeded as a node key at every start, so workers holding it can join a leader whose store was wiped. It is empty by default: there is no built-in shared secret.
- The store is in memory unless
Start a managed worker
export OPOD_JOIN_TOKEN=sk-orc-<node-token> export OPOD_NODE_ID=n_slot-0 # a stable identity per slot export OPOD_ENGINE=vllm export OPOD_LOAD_MODEL=qwen2.5-7b-instruct export OPOD_ENGINE_FLAGS='{"max_model_len":"32768","gpu_memory_utilization":"0.85"}' export OPOD_ADVERTISE_ADDR=192.0.2.12:8081 export OPOD_PLAN_REVISION=7 # the plan revision this process serves opod join http://leader.internal:8080OPOD_LOAD_MODELmakes the worker load that model itself once its engine answers. Repo and file come from the catalog;OPOD_LOAD_REPOandOPOD_LOAD_FILEoverride them.OPOD_REJECT_BEARER=1makes the worker's API accept HMAC-signed calls only.OPOD_PLAN_REVISIONtells the leader which plan revision this process serves, for a traffic split between revisions.OPOD_WORKER_ROLE=prefill|decoderegisters a disaggregated role.OPOD_DRAIN_SECONDSbounds how long a stopping worker lets requests finish.
In Kubernetes, a worker with no
OPOD_NODE_IDand no savednode.yamltakesn_<POD_NAME>as its id.
The plan file
The plan says what this endpoint is. A leader with a plan serves one model identity: requests for any other model are refused with a pointer to the one it serves. The plan file is watched only when it exists at start. Without it the leader is unrestricted. See Plan file.
The auth snapshot
The auth snapshot carries the endpoint's keys as SHA-256 hashes. The leader never sees a plaintext key. Keys from the snapshot are stored with the prefix k_cp_ + their id, and every usage row and event names them that way. A snapshot key that leaves the file is revoked. Keys you minted locally with opod token create are never touched.
The auth file may appear after the leader starts; the leader keeps checking for it. OPOD_AUTH_FILE=off turns the watcher off. See Auth snapshot.
The policy snapshot
The policy snapshot tunes routing, the access log, admission, the wake rules and an optional fallback URL. OPOD_POLICY_FILE=off turns the watcher off. See Policy snapshot.
Check it worked
Ask the leader what it speaks, and whether it is ready:
curl -s http://leader:8080/admin/v1/version -H "Authorization: Bearer $ADMIN"
curl -s http://leader:8080/admin/v1/capabilities -H "Authorization: Bearer $ADMIN"
opod version --featurescurl -s -o /dev/null -w '%{http_code}\n' http://leader:8080/readyz # 200 once it can serve/admin/v1/capabilities returns the contract version (contract: "v1"), the stable route list, a map of feature flags, and the engine drivers linked into the binary. Probe a feature flag rather than guessing from the version. The leader image carries the same list in the OCI label io.opod.leader.features, so a manager can read it from the registry before it runs the image.
Probes for an orchestrator
| Probe | Use |
|---|---|
GET /healthz | Liveness. Always 200 ok while the process serves HTTP. |
GET /readyz | Readiness. 200 when the leader can serve, or sleeps on purpose; 503 otherwise. |
GET /loadz | Load numbers for an autoscaler. |
Set OPOD_PROBE_LISTEN=:8081 to serve the probes and /metrics on a second, always-plain port, so a probe needs no certificate when the main listener speaks TLS. See Probes.
What survives a manager outage
| The manager is down | Effect on the leader |
|---|---|
| no admin calls | serving continues; nothing changes |
| files not rewritten | the leader keeps the last good plan, keys and policy |
| a file is rewritten with bad JSON | a warning is logged and the last good copy is kept |
| usage and events not pulled | rows accumulate in the store; the cursor replays them later |
| usage push not answered (core v0.4.0) | records wait in memory, up to OPOD_USAGE_QUEUE_MB (64 MiB, about 440,000 records), and are sent when the receiver answers; past the cap the oldest are dropped and counted on opod_usage_dropped_total. A leader restart loses what was queued |
By default a leader keeps serving from an old auth snapshot indefinitely. To make revocation win instead, set auth.maxSnapshotAgeSec in the policy snapshot and have the manager rewrite the auth snapshot (with a new issuedAt) more often than that. Past the bound, keyed requests get 503 with Retry-After: 30.
If it fails
| Symptom | Fix |
|---|---|
Every request gets 404 this endpoint serves only X (requested Y) | The plan names model X. Send that id, or change the plan. |
| A rewritten file has no effect and the log warns | The file is not valid JSON. The leader kept the last good copy. Fix the file; it is read again within 10 seconds. |
Keyed requests get 503 with Retry-After: 30 | The auth snapshot is older than auth.maxSnapshotAgeSec. Rewrite it with a new issuedAt. |
| A managed leader forgot its keys and nodes after a restart | Its store is in memory. Seed keys from the auth snapshot, or set OPOD_STORAGE_DSN to a file. |
| Workers cannot join after the leader restarted | Set OPOD_JOIN_TOKEN on the leader so the same node key is seeded at every start. |
A worker logs OPOD_PLAN_REVISION "x" is not a positive number — this worker joins the unversioned group | Set a whole number above 0. |
Last updated · Source: content/docs/core/managed-mode.mdx · View as Markdown