We set up a cluster consisting of a head node that handles load balancing and monitoring and several pool nodes, capable of running virtual machines.
We have 2 networks: for physical hosts and virtual hosts. Head node has two interface for both of the networks. We use bridge interfaces on the physical hosts with direct connection to the underlying network.
Physical host network: 192.168.1.0/24
Virtual host network: 192.168.122.0/24
At the head node:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.122.100 192.168.1.67 255.255.255.255 UGH 0 0 0 br0 192.168.122.103 192.168.1.65 255.255.255.255 UGH 0 0 0 br0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 br0 0.0.0.0 192.168.1.199 0.0.0.0 UG 100 0 0 br0
Explanations:
At the pool node:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.122.100 0.0.0.0 255.255.255.255 UH 0 0 0 br0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 br0 192.168.122.0 192.168.1.68 255.255.255.0 UG 0 0 0 br0 0.0.0.0 192.168.1.199 0.0.0.0 UG 100 0 0 br0
Explanations:
At the virtual machine:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.122.3 0.0.0.0 UG 0 0 0 eth0
Explanations:
We use ganglia to monitor the machines. Ganglia gmetad is installed at the head node.
gmond.conf of the virtual machine should include the following line.
udp_send_channel { host = 192.168.122.3 port = 8650 ttl = 3 }
We use libvirt over Qemu+KVM to run the virtual machines. Host OS is Ubuntu 9.04.
Before starting a new VM:
On the head node:
route add -host 192.168.122.<vmIP> gw 192.168.1.<pIP> br0
On the pool node:
route add -host 192.168.122.<vmIP> br0
After stopping a VM: same commands just use del instead of add.