Daemon mode
rk daemon turns a host into a worker for Runik Control, which schedules jobs across many workers and keeps their reports. The worker connects out to Runik Control, runs one job at a time, and streams events and the report back. It keeps no state of its own between jobs.
Daemon mode needs the licence feature fleet.worker (Enterprise).
Shell
Flags
| Flag | Default | What it does |
|---|---|---|
-control <host:port> | required: Runik Control's address | |
-token-file <path> | $RK_TOKEN_FILE | the join token, its first line. rk warns if other users can read the file |
-token <t> | $RK_TOKEN | the token on the command line; rk warns, because other users can see it in the process list |
-tls | TLS with the system's trusted CAs | |
-ca <pem> | TLS with this CA | |
-cert, -key | mutual TLS. The certificate's CN or a DNS SAN must equal -id | |
-server-name | the TLS server name to verify | |
-insecure | allow cleartext. Without it, cleartext to anything but loopback is refused | |
-id | the hostname | the worker's identity |
-labels k=v,... | labels for scheduling. Empty, duplicate or valueless labels are an error | |
-drain-timeout | 20s | how long a shutdown waits for held reports to be delivered |
-max-held-bytes | 256 MiB | memory for reports waiting to be delivered (at least 64 MiB) |
-metrics-port, -metrics-addr | off, 127.0.0.1 | Prometheus metrics (also needs obs.prometheus); see Metrics |
-allow-cmd-actions | off | allow cmd actions; a job can't turn this on |
-debug, -trace, -json, -logfile, -log-caller | logging |
How a worker behaves
- Capabilities. It advertises what it can run:
ngap,diameter,sbi,rest,pfcp,gtpu,fuzz,suite, narrowed to what its licence grants. - One job at a time. A job offered while the worker is busy or draining is answered with an error.
- Every job is checked against the licence: its protocols, environment, rate, starts and subscribers.
- Lost connection. A job keeps running when the connection drops. Its report is held until Runik Control acknowledges it: up to 16 reports and 8 suite cycles, within
-max-held-bytes. When the budget runs out, the worker trims reports first, then drops the oldest. Reconnect:
- it retries with backoff from 1s up to 30s, capped at 5s while it holds reports;
- if Runik Control refuses the worker (bad token or certificate), it exits
1, unless it holds reports. Then it keeps trying for up to 10 minutes.
Signals
First
SIGINTorSIGTERM: the worker drains:- it takes no new job and cancels the running one;
- it waits until its held reports are delivered, or
-drain-timeoutpasses; - it exits
0after a clean drain,1after a timeout.
- A second signal: it exits
1at once. SIGHUP: it re-reads the licence. A licence that doesn't load leaves the old one in place. Changed capabilities are re-announced.
Exit codes
2: no-control, or a bad flag.5: the licence doesn't grantfleet.worker, orobs.prometheuswhen-metrics-portis set.1:- an unsafe transport (cleartext to a remote address without
-insecure); - a token problem;
- a metrics port that can't be bound;
- a refusal from Runik Control.
- an unsafe transport (cleartext to a remote address without