Skip to content

Control-Plane High Availability (Optional) ​

A single appliance protected by cluster HA on shared storage is enough for many environments: if its host fails, the appliance restarts elsewhere within minutes. If the control plane itself must survive a failure without a restart, add two more appliance members to form a three-member cluster.


How It Works ​

  • Every member runs the full appliance stack. PostgreSQL is replicated by Patroni over cockpit0; etcd (also on cockpit0) decides which member is the leader.
  • Keepalived on each member checks its local Patroni (http://<cockpit0-ip>:8008/leader); only the leader holds the floating IP on mgmt0. Users and hosts keep using the floating IP.
  • Each Vapor host is managed by exactly one member at a time, coordinated with PostgreSQL advisory locks. If a member fails, another member takes over its hosts.
  • Use three members on three different hosts. etcd needs a majority, so two members cannot tolerate the loss of either.

cockpit0 must be one network segment shared by every current and future member. Keep it isolated — it carries database replication.


Add a Member ​

Before you start, reserve two more operational IPs and two more HA IPs (for example .241.22–.23 and .249.22–.23 in the addressing plan), and make sure the target hosts have the same free capacity as the first appliance.

  1. In Cockpit, select the Cockpit instance and open Configure › Settings › Cockpit HA. The Cockpit Cluster table lists the current members with name, management IP, Cockpit IP, role and state.
  2. Click Add Node and choose the placement target: datacenter, cluster, a host that does not run another member, and a shared datastore.
  3. Enter the member's hostname (for example cockpit-02), management IP with CIDR, gateway and MTU, and its Cockpit HA IP (cockpit0).
  4. Cockpit generates the member's configuration and a join token. Choose Automated provisioning to let Cockpit create the VM on the selected host, datastore, management network (vmnet-mgmt) and Cockpit network (vmnet-cockpit-ha) with the given memory and disk; or follow the Manual provisioning steps to deploy the appliance image yourself with the three generated cloud-init files.
  5. Follow progress under Provision history. The new member appears in the cluster table as a replica in state running.
  6. Repeat for the third member on a third host.

From the command line ​

The same operation is available on the appliance command line, which is useful for scripted builds and recovery. Set the values once:

bash
LEADER_HA_IP=192.168.249.21   # cockpit0 address of the current leader
NODE_NAME=cockpit-02
NODE_HA_IP=192.168.249.22     # cockpit0 address of the new member

On the leader, print a join token bound to the new member (valid for 10 minutes):

bash
sudo cockpit ha join-token print --ttl-seconds 600 --node-name "$NODE_NAME" --node-ip "$NODE_HA_IP"

On the new member, validate first, then join. Paste the token when prompted, so it does not end up in your shell history:

bash
read -rsp "join token: " TOKEN; echo
sudo cockpit ha join "$LEADER_HA_IP" --join-token "$TOKEN" --node-name "$NODE_NAME" --node-ip "$NODE_HA_IP" --dry-run
sudo cockpit ha join "$LEADER_HA_IP" --join-token "$TOKEN" --node-name "$NODE_NAME" --node-ip "$NODE_HA_IP"
unset TOKEN

Verify and Test ​

bash
sudo patronictl -c /etc/patroni/config.yml list    # 1 Leader + 2 Replica, all running, lag 0
ip -br addr show mgmt0                              # the floating IP is present only on the leader

Test a failover in a maintenance window: shut down the leader appliance VM, confirm that another member becomes leader within seconds, that https://<floating-ip>:7771 answers again, and that hosts reconnect. Start the stopped member again and confirm it rejoins as a replica.

Removing a member

Remove a member with Remove in the Cockpit HA table (or cockpit ha member kick), never by simply deleting its VM. Separate members with DRS anti-affinity rules so they never share a host.