8.1. KVM Hypervisor Host Installation
8.1.1. System Requirements for KVM Hypervisor Hosts
KVM is included with a variety of Linux-based operating systems. Although you are not required to run these distributions, the following are recommended:
CentOS / RHEL: 6.3
Ubuntu: 12.04(.1)
The main requirement for KVM hypervisors is the libvirt and Qemu version. No matter what Linux distribution you are using, make sure the following requirements are met:
libvirt: 0.9.4 or higher
Qemu/KVM: 1.0 or higher
In addition, the following hardware requirements apply:
Within a single cluster, the hosts must be of the same distribution version.
All hosts within a cluster must be homogenous. The CPUs must be of the same type, count, and feature flags.
Must support HVM (Intel-VT or AMD-V enabled)
64-bit x86 CPU (more cores results in better performance)
4 GB of memory
At least 1 NIC
When you deploy CloudStack, the hypervisor host must not have any VMs already running
8.1.2. KVM Installation Overview
If you want to use the Linux Kernel Virtual Machine (KVM) hypervisor to run guest virtual machines, install KVM on the host(s) in your cloud. The material in this section doesn't duplicate KVM installation docs. It provides the CloudStack-specific steps that are needed to prepare a KVM host to work with CloudStack.
Before continuing, make sure that you have applied the latest updates to your host.
It is NOT recommended to run services on this host not controlled by CloudStack.
The procedure for installing a KVM Hypervisor Host is:
Prepare the Operating System
Install and configure libvirt
Configure Security Policies (AppArmor and SELinux)
Install and configure the Agent
8.1.4. Install and configure the Agent
To manage KVM instances on the host CloudStack uses a Agent. This Agent communicates with the Management server and controls all the instances on the host.
First we start by installing the agent:
In RHEL or CentOS:
$ yum install cloud-agent
In Ubuntu:
$ apt-get install cloud-agent
The host is now ready to be added to a cluster. This is covered in a later section, see
Section 6.5, “Adding a Host”. It is recommended that you continue to read the documentation before adding the host!
8.1.7. Configure the network bridges
This is a very important section, please make sure you read this thoroughly.
In order to forward traffic to your instances you will need at least two bridges: public and private.
By default these bridges are called cloudbr0 and cloudbr1, but you do have to make sure they are available on each hypervisor.
The most important factor is that you keep the configuration consistent on all your hypervisors.
There are many ways to configure your network. In the Basic networking mode you should have two (V)LAN's, one for your private network and one for the public network.
We assume that the hypervisor has one NIC (eth0) with three tagged VLAN's:
VLAN 100 for management of the hypervisor
VLAN 200 for public network of the instances (cloudbr0)
VLAN 300 for private network of the instances (cloudbr1)
On VLAN 100 we give the Hypervisor the IP-Address 192.168.42.11/24 with the gateway 192.168.42.1
The Hypervisor and Management server don't have to be in the same subnet!
8.1.8. Configuring the firewall
The hypervisor needs to be able to communicate with other hypervisors and the management server needs to be able to reach the hypervisor.
In order to do so we have to open the following TCP ports (if you are using a firewall):
22 (SSH)
1798
16509 (libvirt)
5900 - 6100 (VNC consoles)
49152 - 49216 (libvirt live migration)
It depends on the firewall you are using how to open these ports. Below you'll find examples how to open these ports in RHEL/CentOS and Ubuntu.
8.1.8.1. Open ports in RHEL/CentOS
RHEL and CentOS use iptables for firewalling the system, you can open extra ports by executing the following iptable commands:
$ iptables -I INPUT -p tcp -m tcp --dport 22 -j ACCEPT
$ iptables -I INPUT -p tcp -m tcp --dport 1798 -j ACCEPT
$ iptables -I INPUT -p tcp -m tcp --dport 16509 -j ACCEPT
$ iptables -I INPUT -p tcp -m tcp --dport 5900:6100 -j ACCEPT
$ iptables -I INPUT -p tcp -m tcp --dport 49152:49216 -j ACCEPT
These iptable settings are not persistent accross reboots, we have to save them first.
$ iptables-save > /etc/sysconfig/iptables
8.1.8.2. Open ports in Ubuntu
The default firewall under Ubuntu is UFW (Uncomplicated FireWall), which is a Python wrapper around iptables.
To open the required ports, execute the following commands:
$ ufw allow proto tcp from any to any port 22
$ ufw allow proto tcp from any to any port 1798
$ ufw allow proto tcp from any to any port 16509
$ ufw allow proto tcp from any to any port 5900:6100
$ ufw allow proto tcp from any to any port 49152:49216
By default UFW is not enabled on Ubuntu. Executing these commands with the firewall disabled does not enable the firewall.