Learn how to configure a KVM Pacemaker cluster with guest node integration, complete setup commands, and proper configuration for stable performance. Our Live Support Team is always here to help you.

Configure KVM Pacemaker Cluster with Guest Node Integration

Setting up a KVM Pacemaker cluster gives you a powerful high-availability setup that can manage virtual machines like real cluster nodes. Many admins prefer this setup because it keeps services running even when one node fails. Here’s how you can build and integrate KVM virtual guests into Pacemaker, every command you see below is essential.

kvm pacemaker

Configuration Overview for KVM Pacemaker

In a typical Pacemaker cluster, each node runs the complete stack, corosync and all Pacemaker components. This setup offers flexibility but scales only up to around 16 nodes. To expand further, Pacemaker allows virtual guest nodes using libvirt and KVM.

After installing the virtualization software and enabling the libvirtd service, make sure every node and virtual machine share the same encryption key at /etc/pacemaker/authkey.

# mkdir -p --mode=0750 /etc/pacemaker
# chgrp haclient /etc/pacemaker

Generate the encryption key once and copy it to all nodes:

# dd if=/dev/urandom of=/etc/pacemaker/authkey bs=4096 count=1

Preparing the Virtual Machine

Next, install the necessary packages on every virtual machine and start the Pacemaker Remote service.

# yum install pacemaker-remote resource-agents
# systemctl start pacemaker_remote.service
# systemctl enable pacemaker_remote.service
# firewall-cmd --add-port 3121/tcp --permanent
# firewall-cmd --reload

Give each VM a static IP and unique hostname accessible from all cluster nodes. Then dump the VM XML configuration:

# virsh dumpxml guest1 > /etc/pacemaker/guest1.xml

If the VM is running, shut it down. Pacemaker will start it once configured.

Creating VirtualDomain Resource

From a cluster node, create the VirtualDomain resource and define the remote node:

# pcs resource create vm-guest1 VirtualDomain hypervisor="qemu:///system" config="/virtual_machines/vm-guest1.xml" meta remote-node=guest1

You can also group resources together:

# pcs resource create webserver apache configfile=/etc/httpd/conf/httpd.conf op monitor interval=30s
# pcs constraint location webserver prefers guest1

Configuring pacemaker_remote on the Guest Node

Enable the High Availability repo and install the required packages:

[root@guest1 ~]# dnf config-manager --set-enabled highavailability
[root@guest1 ~]# dnf install -y pacemaker-remote resource-agents pcs pacemaker

Bringing the Cluster Online

Now, start Pacemaker on the host:

# pcs cluster start

Then assign a node attribute for hosting the guest VM:

[root@pcmk-1 ~]# pcs node attribute pcmk-1 can-host-vm-guest1=1

Prepare and push the VirtualDomain configuration:

[root@pcmk-1 ~]# pcs cluster cib vm_cfg
[root@pcmk-1 ~]# pcs -f vm_cfg resource create vm-guest1 VirtualDomain \
hypervisor="qemu:///system" config="/etc/libvirt/qemu/vm-guest1.xml"
[root@pcmk-1 ~]# pcs -f vm_cfg constraint location vm-guest1 rule \
resource-discovery=never score=-INFINITY can-host-vm-guest1 ne 1
[root@pcmk-1 ~]# pcs cluster cib-push --config vm_cfg --wait

Check the resource status:

[root@pcmk-1 ~]# pcs resource status

Preparing pcsd and Authenticating

Enable pcsd on the guest:

[root@guest1 ~]# systemctl start pcsd
[root@guest1 ~]# systemctl enable pcsd
[root@guest1 ~]# echo MyPassword | passwd --stdin hacluster
[root@pcmk-1 ~]# pcs host auth guest1 -u hacluster

Adding the Guest Node into the Cluster

Now integrate the guest into the KVM Pacemaker cluster:

[root@pcmk-1 ~]# pcs cluster node add-guest guest1 vm-guest1

Soon you’ll see guest1 appear in the cluster status output:

[root@pcmk-1 ~]# pcs status

And your configuration should resemble:

[root@pcmk-1 ~]# pcs resource config
Resource: vm-guest1 (class=ocf provider=heartbeat type=VirtualDomain)
Attributes: config=/etc/libvirt/qemu/vm-guest1.xml hypervisor=qemu:///system
Meta Attrs: remote-addr=guest1 remote-node=guest1
Operations: migrate_from interval=0s timeout=60s (vm-guest1-migrate_from-interval-0s)
migrate_to interval=0s timeout=120s (vm-guest1-migrate_to-interval-0s)
monitor interval=10s timeout=30s (vm-guest1-monitor-interval-10s)
start interval=0s timeout=90s (vm-guest1-start-interval-0s)
stop interval=0s timeout=90s (vm-guest1-stop-interval-0s)

[If needed, Our team is available 24/7 for additional assistance.]

Conclusion

That’s how you can correctly configure and integrate guest nodes in a KVM Pacemaker environment. Each step matters, from generating the authkey to linking the guest node, to achieve a stable high-availability setup. With proper configuration, your KVM Pacemaker cluster can easily scale while keeping your virtualized workloads protected and running efficiently.