Node drain and replacement
Use this for planned maintenance, a provider host alert, or when node_heartbeat_stale or node_data_disk_low fires.
Before you start
- Use an operator host with the operator CLI:
pushleft-controller fleet list|drain|replace|decommission|admit(drain, decommission, replacement). On the production fleet that is the control-plane host,pl-cp. Reach it and every node through thepl-cpjump host, or open a server’s Terminal in the Fleet app (operator access). - Set
DATABASE_URLto thepushleft_controllerrole. - Set
HETZNER_API_TOKENforreplaceanddecommissionof Hetzner Cloud nodes. Robot hosts need no token:replacerefuses them, anddecommissionleaves the server to you.
Diagnosis
-
Show pool, status, schedulable, CPU/memory/disk used and total, heartbeat age and agent version:
pushleft-controller fleet list -
Find what lives on the node. Open the node’s page in the Fleet app:
- Placements lists the allocations by organization and environment.
- Deployments lists the deployments with instances there.
pushleft-controller fleet deployments-on <node>prints the same list, lost instances included. - Databases lists its managed databases.
- Recent jobs lists its last 25 jobs with their status.
Move the work off the node
One command moves everything that can move, one environment at a time:
pushleft-controller fleet drain <node> --move
- It refuses a node that holds a live ClickHouse or Valkey instance. Those cannot relocate.
- It cordons the node: no new placements, but the node still leases its own exports and stops.
- For each environment on the node, in name order, it:
- Migrates its application volumes. Their roles move with them.
- Relocates its managed PostgreSQL to a node the scheduler picks (restore requests and relocation).
- Starts a replacement for each long-lived instance (web, private, worker) on another node. The old instance stops after the replacement is ready and its routes have moved.
- It waits for each environment before the next one, 30 minutes by default (
--wait <seconds>). - It stops at the first failure and prints the environment and the error. Environments after it are not moved. Fix the cause and run the same command again. It skips work already done or in flight, and it tries a failed database relocation or instance placement again. A replacement instance that failed after it started stays failed: fix or redeploy that environment first.
- It drains the node only when nothing holds capacity there and no volume source copy is left. Source copies of volumes and relocated databases retire on the old node after their grace period, so the node stays active until then. In that case it prints what is left: run the same command again later.
Volumes of web roles and of roles with two volumes are refused (migration between hosts). The command stops there. Ask the tenant to redeploy that environment elsewhere, then run the command again.
Destroys data: ClickHouse and Valkey cannot relocate. Do not drain a node that holds a live instance unless you are prepared to restore from the tenant’s own backups.
Move one kind by hand
- Volumes only:
pushleft-controller fleet migrate-volumes <node>. Run it again to see what is left. - One database:
pushleft-controller fleet relocate-database <instance> --to-node <new-node>.
The source copy of a volume is removed after PUSHLEFT_VOLUME_MIGRATION_GRACE_SECONDS, and a relocated database after PUSHLEFT_DATABASE_RETIRE_GRACE_SECONDS. fleet decommission waits for both.
Drain and replace
-
If you did not use
--move, drain the node. This setsdrainingandschedulable=false, and prints the active allocations and live leases.pushleft-controller fleet drain <node>The gateway refuses new leases from a non-active node (403). Heartbeats and completions of jobs already leased continue.
-
Provision a like-for-like node. The command waits for enrollment and drains the old node.
pushleft-controller fleet replace <node>replaceprovisions Hetzner Cloud servers and Proxmox VMs only. For a Robot host, install the new server and runfleet enroll-hoston it (Robot hosts), then drain the old node. -
Mount the data volume on the new node.
-
Join the new node to the management mesh.
-
Check the new node:
pushleft-agent doctor -
Admit the new node:
pushleft-controller fleet admit <new-node>
Known trap: draining blocks teardown
A draining node cannot lease. The teardown_application, remove_ingress and stop_application jobs targeted at it wait forever. Its allocations stay active, and fleet decommission keeps refusing. fleet drain --move avoids this: the node stays active until its work is gone.
The only fix today is break-glass. Record it in the ticket.
-
Return the node to
activeand keep it unschedulable. The node can then lease the work already targeted at it, and nothing new is placed.pushleft-controller fleet mark-node <node> active --reason "<ticket and reason>"The command accepts only a draining, unschedulable node, and only the status
active. It writes an audit row (operator_cli_action). This also lets the node lease any queued retries of its existing instances. -
Watch
fleet listuntil the allocations reach zero. -
Drain the node again.
Decommission
-
Decommission the node. It waits for zero allocations and zero live leases, revokes every certificate, marks the node
retired, then deletes the server.pushleft-controller fleet decommission <node> --wait 600 -
If the provider delete fails, run the command again. For a Robot host the command prints
bring-your-own host: wipe or cancel it yourself(retiring a Robot host).
Permanent node loss
A node that stops leasing and heartbeating is marked lost after PUSHLEFT_NODE_LOST_AFTER_SECONDS (default 300). This applies whether it was active, unhealthy or draining. Its leases are fenced, its application capacity is released, and its instances are replaced elsewhere (node lost). Database allocations stay held.
To stop a revived disk from acting as the node, decommission it. This revokes its certificates, so it also stops receiving its cleanup list.
pushleft-controller fleet decommission <node>
The command refuses while a stranded database allocation is held. In that case, revoke the certificates only:
pushleft-controller fleet revoke-node-certificates <node> --reason "<ticket and reason>"
Check it worked
fleet listshows the replacement active and heartbeating.- The old node shows zero used capacity, then
retired. node_heartbeat_staleclears.
Do not
- Do not set
fleet_allocations.status = 'released'or delete allocations by hand. Capacity accounting and subnet non-reuse depend on them. - Do not retarget jobs to the replacement node. A job’s identity, lease token and generation are bound to its node.
- Do not delete
fleet_nodesrows. Retirement keeps history.