Skip to content
Kaiov0.8.0

Multiple servers

Kaio manages the Docker daemon of the host it runs on. To operate several hosts, run Kaio on each of them and have them join the instance you use as your entry point, which keeps the registry.

Nothing distinguishes a node from an ordinary Kaio: the API it already serves is the protocol. The instance you type commands at simply keeps a list of the others, knows whether they answer, and drives them from its own interfaces.

A server joins by presenting a join token, and the registry fills itself. All three interfaces then read it: the web UI under Manage → Nodes, the TUI’s Nodes tab, and kaio-cli node on the command line.

On the server you use as your entry point, mint a join token. Each call mints a new one, and each one lets one server in, once, within 24 hours:

Terminal window
kaio-cli cluster token
To add a server to this cluster, run the following on it:
kaio-cli join <this server's address> --join-token KAIO-1-8443a88d…
The token lets one server in, once, until 2026-10-17 09:12:44 UTC.

The web UI hands out the same command under Manage → Nodes → + Add node, with a fresh token each time the modal opens:

The Add a node modal over the Cluster Nodes panel: the kaio-cli join command with its token, a Copy button, and the date the token runs out.
Manage → Nodes → + Add node: the command to run on the new server.

Run that on the new server. It enrols itself:

Terminal window
kaio-cli join 10.0.0.1:8080 --join-token KAIO-1-8443a88d… --name web-01
Joined the cluster at http://10.0.0.1:8080 as web-01.

Nothing was typed on the control plane, and its registry now holds web-01. The web UI shows it arrive without a reload: joining records an event, and the Nodes panel follows the same stream the dashboard does.

kaio-cli cluster info, on either server, says which role it plays: a server can keep a registry, belong to a cluster, both, or neither.

Joining also trades keys. Every Kaio holds an Ed25519 key pair of its own, minted with its identity and kept in its data/. The joining server signs its request with it, the control plane pins that public key to the node’s row and answers with its own public key, and the node keeps that one. From then on the control plane signs every call it sends the node: what the web UI, the CLI and the TUI do through it, the shell’s WebSocket, the probes’ follow-ups and the copies of Copying a stack. Each signature carries the user the control plane is acting for and their level, so the node holds the call to that level and names that user in its audit log.

That is also what lets a node close its door. A server that joined a cluster starts on an address off the loopback with nothing else configured, and answers three kinds of caller only: its own loopback, the networks its own KAIO_ALLOWED_NETWORKS names, and its control plane, by signature, from wherever it calls. KAIO_CLUSTER_LEVEL caps what the control plane may do there, admin by default:

Terminal window
KAIO_ADDR=0.0.0.0:8080
KAIO_CLUSTER_LEVEL=write

Every server of a cluster runs the same signature format, so upgrade them together: see How to upgrade.

The join token is therefore only good for joining. The control plane stores only its SHA-256, spends it on the join it lets through, and the node does not keep it. Joining again, to move or after an upgrade, takes a fresh one. kaio-cli cluster token --rotate retires every token not used yet before minting the next: servers already enrolled carry on, copies included.

--name defaults to the host’s own name; the control plane lowercases it into the node-name charset and suffixes it if it is taken, so two hosts called web both get in, as web and web-2. Joining twice from the same address keeps the entry already there rather than piling up duplicates.

Every Kaio mints an identity for itself the first time it needs one, and keeps it for the life of its data/. It is what a joining server presents, and it becomes the id of its row in the registry.

That is what lets a node move. A server whose address changes (a DHCP lease, a container on a new bridge) simply joins again: it is recognised, its address is corrected, and it keeps its name. No second entry, no stale row left answering nothing.

Being recognised takes more than the identity, which /api/health publishes: a server joining again under an identity already in the registry must sign with the key it first joined with. Knowing a node’s identity is not enough to point its row somewhere else.

A server that was reinstalled arrives with a new identity, so it cannot be recognised. It is enrolled alongside the row it replaces, and that old row is dropped only once the newcomer has actually answered at that address. Naming someone else’s address is therefore not enough to evict them.

It is also how a server knows not to enrol itself:

The control plane refused the join: This server is the control plane;
it cannot join itself

And how a probe tells a node apart from a stranger that took its address: /api/health carries the identity, so a reply from the wrong machine is reported as unreachable rather than vouched for.

--advertise host:port says how the control plane should reach the new server, and you rarely need it: the joining server reports its own KAIO_ADDR, and the control plane fills in the address the request arrived from when that address is a wildcard. A server listening on 0.0.0.0:9000 is therefore enrolled at the right port without being told.

Give it when the address the server knows about is not the one others reach it at. Three cases, and the middle one is easy to miss:

  • behind NAT, or a reverse proxy on another host and port;
  • a published port that differs from the internal one. With ports: "9000:8080" and KAIO_ADDR=0.0.0.0:8080, the server reports port 8080, which is the one inside the container. The control plane pairs it with the host’s address and enrols an unreachable :8080. Pass --advertise <host>:9000;
  • the two servers on the same machine, where the request appears to come from the control plane itself.

When nothing usable can be worked out, Kaio says so rather than guessing:

The control plane refused the join: Could not work out how to reach this node:
pass --advertise <host:port>

A server enters the registry by joining, and by nothing else: there is no command and no form that declares one from the control plane. That keeps one fact in one place: the node itself says where it is, rather than someone retyping an address that may already be wrong.

A server leaves on its own, with one command, from the machine that is leaving:

Terminal window
kaio-cli cluster leave
Left the cluster at http://10.0.0.1:8080. It no longer lists prod-01.

It tells its control plane to drop the registry entry, then forgets it locally. Both sides agree afterwards, and the route through the control plane closes with the entry.

A node does not depend on its control plane being up to go: if it cannot be reached, the node forgets the cluster anyway and says what is left to do.

Left the cluster at http://10.0.0.1:8080 locally.
Warning: it was not told (could not reach it: …), so it still lists prod-01.
Remove it there with `kaio-cli node rm prod-01`.

The control plane can also evict: kaio-cli node rm prod-01, Remove in the web UI, or d in the TUI. That drops the entry without telling the node, which keeps thinking it is a member until someone runs cluster leave on it. Either side can end it; only the node’s own command leaves both in agreement.

Each node carries the result of its last probe, which is a call to the node’s /api/health:

Status Meaning
online The node answered and identified itself as a Kaio
offline Unreachable, or it answered something else
unauthorized Something in front of the node asked for a credential
unknown Joined, never probed

VERSION is what the node reports, which is how you spot a host left behind by an upgrade. SHA is the git commit that binary was built from, which separates two hosts that claim the same version because one of them runs a build from before a fix. LAST SEEN is the last successful contact and survives a node going down, so you can tell a host that just died from one that never answered.

Probe on demand, one node or all of them:

Terminal window
kaio-cli node check prod
kaio-cli node check

The web UI does the same with the per-row Check button and Check All; the TUI with c and C.

The server also probes every node by itself, every KAIO_NODE_HEALTH_INTERVAL_SECONDS (default 60, 0 disables it). Probes run concurrently and a status change records an event, so a node flapping shows up in the event log while a node quietly staying online does not fill it.

Terminal window
kaio-cli node ls # the control plane, then every node with its last probe
kaio-cli node show prod
kaio-cli --json node show prod

All three put the control plane on the first row, with the version and commit it runs, so a node still on an older release shows at a glance. That row has no probe and cannot be removed; --json leaves it out and returns the registry alone.

A node that answers with another release than the control plane, down to the patch number, so 0.8.0 against 0.8.1 counts, has its version marked ≠, in yellow, everywhere nodes are listed, and release_differs: true in --json and on the MCP endpoint. A node that has not answered yet carries no version and no mark. Upgrade both to the same release: until then, what the control plane reads from that node, its stacks on the cluster board among them, can be incomplete.

The web UI lists the same rows with a Check and a Remove button each, and the TUI’s Nodes tab does it with c (probe the selected node), C (probe them all) and d (remove it).

To see what runs where rather than how each node answers, Manage → Cluster board puts every server side by side, one card per stack, and copies a stack when you drag its card onto another server. See Cluster board.

The Cluster Nodes panel: the control plane on the first row, then three servers with their status, URL, reported version, commit and last contact. One is offline and shows the reason underneath.
Manage → Nodes: the control plane and the servers that joined it.

There are two ways, and they differ in what happens when the node leaves the registry.

Pick a node from the @ control plane ▼ selector in the header and the whole dashboard switches to it: stacks, containers, metrics, events, logs, CVE scans and the container terminal all report that node. The page moves to /node/<name>, so that view is a link you can share. Deploying a stack there is the ordinary + STACK button.

On the command line, name the node and what to run on it:

Terminal window
kaio-cli node prod-01 run status
kaio-cli node prod-01 run stack deploy web compose.yml
kaio-cli node prod-01 run tui

Anything after run is an ordinary Kaio command, forwarded by the control plane to that node.

An agent does the same over MCP: one entry, the control plane’s /mcp, and the node named in the node argument every tool takes, as across a cluster describes.

Removing a node ends this. The route is the registry entry, so kaio-cli node rm prod-01 makes every one of the commands above answer:

Node 'prod-01' has not joined this cluster

Aiming at the address works when the node lets you in: from the node itself, from a network its KAIO_ALLOWED_NETWORKS names, or through a proxy its KAIO_TRUSTED_PROXIES names.

Terminal window
KAIO_ADDR=10.0.0.2:8080 kaio-cli status

From anywhere else the node answers 403, and the control plane is the way in. Every Kaio serves the full web UI at its own address, to the callers it accepts. Its /mcp is the exception: a node closes it, whatever KAIO_MCP says, and tells the agent to go through the control plane.

  • Every node needs its own data/. Nodes share nothing: each keeps its own database, its own stack files and its own history.
  • The join token is a credential, briefly. It works once and for 24 hours, and the control plane keeps only its hash, so reading the database does not give it back. Anyone who reaches the control plane’s port can still mint one, as they can drive its daemon. If one leaks before it is used, kaio-cli cluster token --rotate retires it; the nodes already in the cluster are not affected.

Kaio, built by Régis Gaidot