Skip to content
Kaiov0.8.0

Installation

One command, and Kaio is an ordinary service your system starts and restarts like any other. kaio-server is a single binary, dashboard and all, configured entirely through the environment, so systemd supervises it directly and nothing of Kaio itself runs in a container.

The host has to provide three things, which the published image otherwise carries:

  • Docker itself, and this one is not optional: kaio-server connects to the daemon at startup and exits when it cannot, which systemd turns into a restart loop. Install it first, with curl -fsSL https://get.docker.com | sh
  • the Docker CLI with the Compose plugin, since every stack is deployed by shelling out to docker compose. Without it the server runs and the dashboard fills, then each deploy, update, rollback and restart fails. The Docker script in the bullet above installs it; on a host whose Docker came from elsewhere, add docker-compose-plugin, or the distribution’s equivalent
  • Skopeo, used by the update checker to inspect remote image digests

Check all three before installing Kaio, since the installer only warns about what is missing:

Terminal window
docker version && docker compose version && skopeo --version
Terminal window
curl -fsSL https://kaio-labs.gaidot.net/install.sh | sh
systemctl enable --now kaio

That writes KAIO_ADDR=127.0.0.1:8080 into /etc/kaio/kaio.env: the server answers this host only, which is the right answer with a reverse proxy or a tunnel in front, and the only one that is safe with nothing in front. Kaio authenticates no one, so an address off the loopback is a decision about who may reach it, and the server refuses to start on one until you have made it. See Security.

To answer the network, give the address and say who is trusted in the same command:

Terminal window
curl -fsSL https://kaio-labs.gaidot.net/install.sh | \
KAIO_ADDR=100.84.12.7:8080 KAIO_ALLOWED_NETWORKS=100.64.0.0/10 sh

KAIO_TRUSTED_PROXIES, KAIO_ALLOWED_NETWORKS and KAIO_I_UNDERSTAND_NO_AUTH given this way land in /etc/kaio/kaio.env beside KAIO_ADDR. Later, kaio-server setup lan or setup proxy <IP> changes that choice without editing the file by hand: see Pick your case. An existing /etc/kaio/kaio.env is never overwritten, so reinstalling keeps your configuration.

It works out the architecture, fetches the matching tarball, verifies its checksum when one is published next to it, then runs the install.sh the archive carries. Everything happens in a temporary directory that is removed on the way out. Run it as root, or have sudo on the host: it elevates only for the install step, and prints what it is doing.

Run the same command again to upgrade: /etc/kaio/kaio.env is kept, both binaries are replaced, the dashboard with them, and the service restarts only if it was already running. Before replacing anything, the new kaio-server checks that it would start with that file, and the upgrade stops there, the running version untouched, when it would not: see How to upgrade. KAIO_BASE_URL points it at another directory, KAIO_TARBALL at another file name.

/etc/kaio/kaio.env carries every optional variable commented out, the MCP endpoint and Prometheus metrics included, so turning one on is uncommenting two lines and systemctl restart kaio. A binary install is scraped exactly like a container one: Prometheus reaches that host’s port and neither knows nor cares how Kaio got there.

What it prints at the end is a numbered list of what is left to do, and it adapts: a host without Docker is told so first, with the consequence spelled out, and a step about reaching the server from elsewhere appears when it answers on the loopback alone.

installed; the server will listen on 127.0.0.1:8080
1. it answers on the loopback only. To reach it from elsewhere,
put an authenticating proxy in front and set KAIO_TRUSTED_PROXIES,
or bind an overlay address and set KAIO_ALLOWED_NETWORKS, in
/etc/kaio/kaio.env. https://kaio-labs.gaidot.net/operations/hardening/
2. systemctl enable --now kaio
3. kaio-cli status, in a new shell so it picks that address up

install.sh warns about a missing docker, docker compose or skopeo instead of failing: the binaries install fine, the features that shell out to them do not work until the tools are there. It creates the docker group when the host has none, because the unit joins it and systemd refuses to start a service whose supplementary group does not exist, with a 216/GROUP that names nothing; the Docker packages reuse that group when they are installed later. Run it again to upgrade: it keeps /etc/kaio/kaio.env, replaces both binaries, and restarts the service only if it was already running. Back up before you do, for the reason given in Upgrading.

Piping a script into a shell is not the only way in. The same installer sits in the release tarball, for a host that will not do that or where you would rather read what runs first, and the published image skips the installer entirely: both are in Other ways to install.

One variable more and the same command also stands up the monitoring: a Prometheus scraping this host, an Alertmanager holding its alerts, and a Grafana with the Kaio dashboard, the data source and nine alert rules already provisioned.

Terminal window
curl -fsSL https://kaio-labs.gaidot.net/install.sh | KAIO_MONITORING=on sh

From an unpacked tarball it is a flag instead, sudo ./install.sh --with-monitoring. Either way nothing of the sort is installed without it: left out, the install is exactly what the rest of this page describes, and no image is pulled.

With it, the script fills in what the stack needs rather than asking you:

  • it turns /metrics on in /etc/kaio/kaio.env behind a generated token, and writes that same token to /etc/kaio/monitoring/token, which is the file Prometheus reads as its credentials_file. One secret, two files, never out of step
  • it writes /etc/kaio/monitoring/prometheus.yml pointed at this host, at the address KAIO_ADDR settled on, and at its node registry: every server enrolled with kaio-cli join is then scraped without editing a file. A server outside the cluster goes in targets.yml, read as well, every 30 seconds
  • it generates Grafana’s admin password into /etc/kaio/monitoring/monitoring.env, mode 600, and prints it once
  • then docker compose up -d, so Grafana answers before the script returns
installed; the server will listen on 10.0.0.2:8080
1. systemctl enable --now kaio
2. kaio-cli status, in a new shell so it picks that address up
monitoring is up, from /etc/kaio/monitoring
Grafana http://10.0.0.2:3000 admin / 8f3c1d94a7b25e60c4a1
Prometheus http://10.0.0.2:9090
Alertmanager http://10.0.0.2:9093

Docker missing is not an error here: the stack is written out, ready, and the script prints the docker compose line to run once Docker is there.

Reinstalling never overwrites a file in /etc/kaio/monitoring. The ones you filled in are kept, and so are the shipped ones you edited: when a release changes a file you had changed, the new version lands beside it as <name>.new and the script says which, leaving the merge to you.

KAIO_ADDR matters more than usual with this flag. Prometheus scrapes from inside a container, so a Kaio bound to 127.0.0.1 cannot be reached at all: the script writes the host’s routed address into prometheus.yml anyway, and warns that the target will read as down until Kaio listens somewhere a container reaches. /metrics answers anyone who carries its token, so the scrape itself needs no other right; what the bind needs is a statement of who else may connect. To let containers reach /metrics and nothing more:

Terminal window
curl -fsSL https://kaio-labs.gaidot.net/install.sh | \
KAIO_MONITORING=on KAIO_ADDR=0.0.0.0:8080 KAIO_ALLOWED_NETWORKS=172.16.0.0/12 sh
echo KAIO_NETWORK_LEVEL=off | sudo tee -a /etc/kaio/kaio.env

The bridge networks are then accepted at the level off: they can reach the routes that carry their own proof, /metrics with its token among them, and are refused everything else.

On a cluster, the other servers need /metrics on and the same token: one scrape job carries one credential, so a node with a token of its own answers 401. KAIO_METRICS_TOKEN is what spares you editing kaio.env on each of them, and it turns /metrics on by itself, with none of the monitoring stack:

Terminal window
curl -fsSL https://kaio-labs.gaidot.net/install.sh | KAIO_METRICS_TOKEN=<the shared token> sh

Give it on the monitoring host too and the stack is built around that token rather than a generated one. Pass it again later with a new value and it is rotated everywhere the installer wrote it.

Prometheus and Grafana is the whole of it: every metric, the alert rules, and how to have Kaio name the rest of your cluster instead of maintaining targets.yml by hand.

Path Holds
/usr/local/bin/kaio-server, /usr/local/bin/kaio-cli the binaries
/var/lib/kaio the SQLite database and stacks/<name>/compose.yml
/etc/kaio/kaio.env the configuration, never overwritten
/etc/kaio/monitoring the monitoring stack, and only with --with-monitoring
/etc/systemd/system/kaio.service the unit
/usr/bin/kaio-server, /usr/bin/kaio-cli symlinks, and only when /usr/local/bin is absent from PATH
/etc/profile.d/kaio.sh exports KAIO_ADDR for login shells, reading it from /etc/kaio/kaio.env

Everything you configure is under /etc/kaio, so that is the directory to copy when you move a host or keep a record of one. Installs from before 0.3.8 kept the configuration at /etc/kaio.env: the script moves it to /etc/kaio/kaio.env unchanged on the next run and leaves a symlink at the old path, so a script of yours that reads it keeps working.

The profile snippet is what spares you an Error: server unreachable from the CLI: bind the server to 10.0.0.2:8080 and 127.0.0.1 stops answering, while kaio-cli still defaults to it. It reads the file at each login rather than baking a value in, so editing KAIO_ADDR is enough, and a wildcard bind becomes 127.0.0.1 since that is what the CLI can reach. It applies to login shells, so ssh host kaio-cli status still needs the variable spelled out.

/var/lib/kaio is the one directory to back up, and it is owned by the kaio system user the script creates. Database migrations are compiled into the binary and run at startup.

/etc/systemd/system/kaio.service
[Unit]
Description=Kaio
After=docker.service network-online.target
Wants=network-online.target
[Service]
User=kaio
Group=kaio
SupplementaryGroups=docker
WorkingDirectory=/var/lib/kaio
EnvironmentFile=/etc/kaio/kaio.env
ExecStart=/usr/local/bin/kaio-server
Restart=always
RestartSec=5
NoNewPrivileges=yes
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full
ReadWritePaths=/var/lib/kaio
[Install]
WantedBy=multi-user.target
/etc/kaio/kaio.env
KAIO_ADDR=127.0.0.1:8080
KAIO_DB=sqlite:/var/lib/kaio/kaio.db
KAIO_STACKS_DIR=/var/lib/kaio/stacks
KAIO_EVENTS_RETENTION_DAYS=30
KAIO_LOGS_TAIL=100
RUST_LOG=info
# Everything below is optional, shown with the default it falls back to.
# Uncomment what you need. Full reference:
# https://kaio-labs.gaidot.net/reference/configuration/
# Who may reach the server. Kaio authenticates no one, so a KAIO_ADDR off the
# loopback refuses to start until one of these says who is trusted.
# https://kaio-labs.gaidot.net/operations/security/
# The reverse proxy that authenticates, by IP or CIDR. Its identity headers count.
#KAIO_TRUSTED_PROXIES=
# A secret the proxy sends as X-Kaio-Proxy-Secret, read from a file Kaio alone reads.
#KAIO_PROXY_SECRET_FILE=
# Networks allowed to connect directly, with no identity: a tailnet, a WireGuard range.
#KAIO_ALLOWED_NETWORKS=
# Groups from the proxy's Remote-Groups header mapped to a level.
#KAIO_GROUPS_READ=
#KAIO_GROUPS_WRITE=
#KAIO_GROUPS_ADMIN=
# The old behaviour: anyone who reaches the port drives the daemon.
#KAIO_I_UNDERSTAND_NO_AUTH=no
# The MCP endpoint for AI agents, off until you set it. Each rung adds tools to
# the one below it: read, write, admin. https://kaio-labs.gaidot.net/reference/mcp/
#KAIO_MCP=off
# Host headers /mcp answers, on top of loopback, which is all it accepts unset.
# A remote agent needs its name here, or * to accept any.
#KAIO_MCP_ALLOWED_HOSTS=
# Browser origins allowed to call /mcp. Unset refuses every request carrying an
# Origin header, which is what an agent or a CLI never sends.
#KAIO_MCP_ALLOWED_ORIGINS=
# Prometheus metrics at /metrics, off until you set it. The token is optional and
# recommended: /metrics lists stack names, image names and CVE counts.
# https://kaio-labs.gaidot.net/operations/metrics/
#KAIO_METRICS=off
#KAIO_METRICS_TOKEN=
# Browser origins allowed to call the REST API. Unset allows the dashboard's own.
#KAIO_ALLOWED_ORIGINS=
# A Docker daemon other than the local socket, unix:// or tcp://
#KAIO_DOCKER_HOST=
# Background loops. 0 turns one off.
#KAIO_UPDATE_CHECK_INTERVAL_HOURS=12
#KAIO_TRIVY_SCAN_INTERVAL_HOURS=24
#KAIO_NODE_HEALTH_INTERVAL_SECONDS=60
# The scanner: how many images at once, and the image it runs.
#KAIO_TRIVY_CONCURRENCY=2
#KAIO_TRIVY_IMAGE=aquasec/trivy:latest

That is the file as shipped, and what the installer writes unless you give it another KAIO_ADDR: 127.0.0.1:8080 is the value to keep when a reverse proxy terminates TLS in front of the server. The dashboard is compiled into kaio-server, so there is no asset directory to install, nothing to point a variable at, and nothing that breaks if you move the binary. See Configuration for every variable.

Every other variable, and the default it falls back to, is in Configuration. The install writes them all into /etc/kaio/kaio.env, commented out, so the file doubles as the list.

Terminal window
systemctl status kaio
journalctl -u kaio -f

The CLI reads the same KAIO_ADDR, so it finds the service with nothing else set:

Terminal window
export KAIO_ADDR=127.0.0.1:8080
kaio-cli status
kaio-cli tui

Under rootless Podman, drop the system user and run the unit as yourself: put it in ~/.config/systemd/user/kaio.service without the User/Group/ SupplementaryGroups lines, add Environment=KAIO_DOCKER_HOST=unix://%t/podman/podman.sock to [Service] (%t expands to the runtime directory, and specifiers are not expanded inside an environment file), and manage it with systemctl --user. loginctl enable-linger $USER keeps it running without an open session. The caveats of rootless operation are in Podman.

Kaio, built by Régis Gaidot