Fleet operations
Every procedure here drains a server before it touches the server. A drain
withdraws the anycast route of the server, through the anycast-guard of
the server. The procedure announces the route again only after the server
is healthy. Clients then move to the next PoP and do not fail.
| Command | Does |
|---|---|
fleetctl pop add --pop P [--server S] [--site-env FILE] [--soak 60s] [--dry-run] |
a new server from inventory entry to announced |
fleetctl pop remove POP [--server S] [--grace 30s] [--dry-run] |
drain, empty and scale away a server or a PoP |
fleetctl fleet reboot --all|--wave W|POP... [--grace 30s] [--pause 30s] [--dry-run] |
reboot servers one at a time through drain |
fleetctl fleet update --image TAG --all|--wave W|POP... |
install a host release and reboot, one server at a time |
fleetctl agent status [POP...] |
the host agents: up since, release, last action |
fleetctl pop status, pop drain, pop undrain |
the state of the guards. Withdraw or return a PoP by hand |
Add a PoP
Section titled “Add a PoP”fleetctl pop add takes a server from the fleet inventory to announced.
Before you start, test the inventory with fleetctl inventory validate.
The command has 11 steps:
- Inventory.
- Rendered configuration in Nomad variables: BIRD, Unbound and the
per-server settings of the edge, plus the site settings from
--site-env. - The node pool of the wave.
- The Nomad client joins.
- The
pop-systemjob is placed. - The new guard is held drained.
- The
resolverjob of the wave is scaled up by count only. The other servers of the wave keep their allocations. - Health: 20 good probes, both BGP sessions up, a live dead-man lease.
- An identity test:
id.serveron the unicast address names the new server. - The announcement.
- A soak, during which the server must stay announced.
--dry-runprints what each step is going to write. It changes nothing.- You can start the command before the server is up. It waits for the Nomad client.
- If the command fails, run it again. Every step reads the current state first. Each waiting step says what it waits for.
- Start the command only when every other PoP is announced
(
fleetctl pop status). - Install the server first with the PoP bootstrap script. The script applies the hardening and installs the Nomad client with mTLS and the host agent.
- The upstream network must configure the upstream BGP session of the server. Step 8 waits for it.
Remove a server or a PoP
Section titled “Remove a server or a PoP”fleetctl pop remove POP does these steps:
- It drains the guards, server by server, and waits
--gracefor the queries in flight. - It drains the Nomad node with its system jobs, and waits until nothing runs there.
- It scales the
resolverjob of the wave down by count only. It makes sure that the other allocations of the wave are not changed. - It deletes the three Nomad variables of the server.
--server S removes one server of a PoP. The command refuses to run while
another PoP is withdrawn. --force overrides this. At the end, the
command prints the remaining tasks. Remove the entry from the inventory.
Stop the Nomad client of the server, and run nomad node purge on it.
Reboot and host updates
Section titled “Reboot and host updates”fleetctl fleet reboot and fleetctl fleet update --image TAG go through
the selected servers in wave order, canary first. They work on one server
fleet-wide at a time, never two of a PoP together. For each server:
- Guardrails: no
resolverrollout running, every other server announced, the host agent of the server answering and idle. - Drain. Make sure that BIRD withdrew the route, then wait
--grace. - Act: the host agent reboots. For an update, it runs the host update with the tag, and reboots only if the update succeeded.
- Wait for the new boot (and, for an update, the new release).
- Health: the Nomad node ready with every allocation running, the guard healthy after 20 good probes (still drained), both BGP sessions up, a live lease.
- Undrain, wait for the announcement, pause
--pause, then go to the next server.
If any step fails, the whole run stops with a non-zero exit. The server
being worked on stays drained. This state is safe, and nothing further is
touched. When the server is healthy, undrain it (fleetctl pop undrain).
Then run the command again for the servers that are not done. Every step
is an event on fleet.events (fleetctl events). Start with
--wave canary, then use --all.
The host agent, pop-agent, runs on each server as the root systemd unit
opdns-pop-agent, outside Nomad. As a result, you can reboot a server even
if its Nomad client or container runtime is broken. The agent answers only
status, reboot and update, on fleet.agent.<pop>. It answers only
requests that name its own server. It refuses to reboot or update unless
its local guard reports that the server is drained and withdrawn. A
replayed or wrong command cannot take an announced server down.
The agent answers first, and acts two seconds later. An update runs
/usr/local/sbin/opdns-pop-update TAG and records the release in
/etc/opdns-release.
If NATS is down, drain with the local socket of the guard, and reboot over SSH, one server at a time. If the Nomad servers are down, do not reboot. See below.
The guardrails examine the fleet before each server. They cannot prevent a second, independent failure during the window. Under heavy load, the health probe of the guard (400 ms, two failures) can withdraw other, healthy PoPs while one PoP reboots.
fleet update --image updates the host release, not the edge. The edge
rolls out through fleetctl rollout. A separate NATS token for
pop-agent is planned.
When the Nomad servers are down
Section titled “When the Nomad servers are down”The PoPs do not need the Nomad servers to serve DNS. Allocations continue
to run. The guards continue to probe health and to announce or withdraw
(BIRD is local). fleetctl pop status, pop drain and pop undrain work
over NATS.
Everything that schedules or reads Nomad stops:
- Rollouts
pop addandpop removefleet rebootandupdate. They refuse to run, unless you use--no-nomadfor a server that is already dark.- Any change carried by Nomad variables: certificate or command token rotations, per-server configuration
During an outage, freeze deploys: no rollouts, no PoP adds or removals, no certificate or token rotations. Do not reboot a PoP server. After a reboot, its Nomad client cannot restore its allocations until it reaches a server, so the server stays dark.
After the servers return, make sure that every node is ready with the
same allocation ids. Then run a rollout with no change. The full procedure
is the Nomad outage runbook in the operator repository.