Deploy Rackspace Private Cloud v4.2.x powered by OpenStack Havana with Neutron Networking Using VirtualBox or VMware Fusion and Vagrant

Thursday, December 19, 2013

Rackspace Private Cloud, and OpenStack on its own, can be a formidable set of software to install. Rackspace Private Cloud uses Chef to deploy OpenStack, and while Chef itself has a high learning curve, its use does make deploying OpenStack easier and more scalable.

Despite this, I find a lot of installation confusion comes from how to setup the virtual machines. How many CPUs do I allocate? How much RAM do I allocate? How much storage should there be? How many NICs do I need and on what networks? Many people may give up at this point or attempt an install with incorrect virtual machine configurations which ruins their experience. However, Vagrant by Hashicorp makes it very easy to define the virtual machines all within a simple text file.

Before going on, I recommend your workstation to have at least 2 physical CPUs and 8GB of RAM. If your workstation does not meet these recommended specifications, you can lower the amount of vCPUs and RAM assigned to each virtual machine in the Vagrantfile with the added risk of running into problems due to low resources.

If you would rather not go through the installation step-by-step, I have created a Vagrantfile containing all of the same steps so all you have to run is vagrant up.

Setup Vagrant

Download and install the latest version of Vagrant for your operating system.

Jump to either the Vagrant with VirtualBox or Vagrant with VMware Fusion section depending on what you want to use.

Using Vagrant with VirtualBox is free compared to using VMware Fusion which cost about $140.00 total.

Vagrant with VirtualBox

Download and install the latest version of VirtualBox for your operating system.

Once VirtualBox is installed, jump to the Setup a Vagrant Environment section.

Vagrant with VMware Fusion

First, purchase ($59.99), download, and install the latest version of VMware Fusion 5 or 6.

In addition, purchase ($79.00) the Vagrant VMware Provider License from HashiCorp; you cannot use Vagrant with VMware Fusion without this license.

Second, once you have purchased the plugin, open Terminal, and install the Vagrant VMware Fusion Provider Plugin:

vagrant plugin install vagrant-vmware-fusion

HashiCorp should have emailed you the Vagrant VMware Fusion Provider License by now. License the provider with the following command (save the license in a safe place, Vagrant will copy the license to it’s own directory as well):

vagrant plugin license vagrant-vmware-fusion ~/Downloads/license.lic

Verify everything is working by running any of the Vagrant commands. An error message will be thrown if there is something wrong.

Once VMware Fusion and the Vagrant Provider License are installed, jump to the Setup a Vagrant Environment section.

Setup a Vagrant Environment

Create a directory somewhere on your workstation to save your Vagrantfile and change into that directory:

mkdir -p ~/Development/vagrant-rpc

cd ~/Development/vagrant-rpc

Run one of the following commands based on which operating system you want to install Rackspace Private Cloud v4.2.x on top of:

Deploy Rackspace Private Cloud v4.2.x on Ubuntu Server 12.04.4 with Neutron Networking

curl https://raw.githubusercontent.com/jameswthorne/vagrantfiles-rpc/master/vagrantfile-manual-rpcv422-ubuntu-neutron-networking.txt -o Vagrantfile

Deploy Rackspace Private Cloud v4.2.x on CentOS 6.5 with Neutron Networking

curl https://raw.githubusercontent.com/jameswthorne/vagrantfiles-rpc/master/vagrantfile-manual-rpcv422-centos-neutron-networking.txt -o Vagrantfile

At this point you are ready to startup your Vagrant environment.

If you are using VirtualBox:

vagrant up

If you run into any errors while running vagrant up, try opening the VirtualBox application, letting it run in the background, and re-run vagrant up.

If you are using VMware Fusion:

vagrant up --provider vmware_fusion

If you run into any errors while running vagrant up --provider vmware_fusion, try running the following commands in Terminal, and re-run vagrant up --provider vmware_fusion:

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --configure

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --start

Setup the Chef Server

Log into your Chef Server:

vagrant ssh chef

Login as the root user and stay logged in as root throughout this process (the root password is vagrant):

su -

Install Chef Server:

curl -O https://raw.githubusercontent.com/rcbops/support-tools/master/chef-install/install-chef-server.sh

chmod +x install-chef-server.sh

export CHEF_URL="https://chef:443"

./install-chef-server.sh

Install the Rackspace Private Cloud v4.2.x powered by OpenStack Havana Chef Cookbooks:

git clone https://github.com/rcbops/chef-cookbooks.git

cd chef-cookbooks

git checkout v4.2.2
git submodule init
git submodule sync
git submodule update

knife cookbook upload -a -o cookbooks

knife role from file roles/*rb

Create the Chef Environment file:

knife environment create rpcv422 -d "Rackspace Private Cloud v4.2.2 powered by OpenStack Havana"

Edit the Chef Environment file. In the export command below, feel free to replace vim with nano or any other command line based text editor you are comfortable with.

export EDITOR=$(which vim)

knife environment edit rpcv422

Once the command line text editor opens with the default Chef Environment, delete everything and input the following Chef Environment Override Attributes:

{
    "name": "rpcv422",
    "description": "Rackspace Private Cloud v4.2.2 powered by OpenStack Havana",
    "cookbook_versions": {},
    "json_class": "Chef::Environment",
    "chef_type": "environment",
    "default_attributes": {},
    "override_attributes": {
        "nova": {
            "libvirt": {
                "virt_type": "qemu",
                "vncserver_listen": "0.0.0.0"
            },
            "network": {
                "provider": "neutron"
            }
        },
        "neutron": {
            "ovs": {
                "provider_networks": [
                    {
                        "label": "ph-eth3",
                        "bridge": "br-eth3"
                    }
                ],
                "network_type": "gre",
                "network": "neutron",
                "external_bridge": ""
            }
        },
        "mysql": {
            "allow_remote_root": true,
            "root_network_acl": "%"
        },
        "osops_networks": {
            "nova": "192.168.236.0/24",
            "public": "192.168.236.0/24",
            "management": "192.168.236.0/24",
            "neutron": "192.168.240.0/24"
        }
    }
}

Create a new password-less SSH Public/Private Key (use the defaults for anything prompted):

ssh-keygen

Copy the SSH Public Key to each node (password is vagrant):

ssh-copy-id root@controller1

ssh-copy-id root@compute1

Install and register Chef Client and set the Chef Environment on each node:

knife bootstrap controller1 --environment rpcv422

knife bootstrap compute1 --environment rpcv422

Add the single-controller and single-network-node roles to the controller1 node:

knife node run_list add controller1 'role[single-controller],role[single-network-node]'

Add the single-compute role to the compute1 node:

knife node run_list add compute1 'role[single-compute]'

The Chef Server is also going to act as a router of sorts for OpenStack Instance connectivity to the internet. Another virtual machine could also be created to do this, but for the sake of saving RAM, I will be configuring the Chef Server to do this.

Turn on IP forwarding:

echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf

sysctl -p

Packets ingress to eth2 are forwarded:

iptables -A FORWARD -i eth2 -j ACCEPT

Packets ingress to eth2 are NAT’d out eth0:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Setup the controller1 Node

Log into your controller1 node:

vagrant ssh controller1

Login as the root user and stay logged in as root throughout this process (the root password is vagrant):

su -

Run chef-client (installation time will partly depend on your internet connection):

chef-client

If chef-client ran successfully, you should now have a working controller node.

The remaining steps in this section are optional, but if you want to fully utilize Neutron Networking and have internet access from your OpenStack Instances, you will need reconfigure eth3 so it can be attached to the Open vSwitch Bridge.

Follow the steps in one of the following two sections that matches the operating system you installed Rackspace Private Cloud on top of.

Ubuntu Network Configuration

Down eth3 and delete its IP address:

ip link set eth3 down

ip address delete 192.168.244.20/24 dev eth3

In /etc/network/interfaces, find auto eth3 and remove that line and the next three lines:

sed -i -e '/auto eth3/,+3d' /etc/network/interfaces

Append the new eth3 configuration to /etc/network/interfaces:

cat << 'EOF' >> /etc/network/interfaces
auto eth3
iface eth3 inet manual
    up ip link set eth3 up
    down ip link set eth3 down
     
iface br-eth3 inet static
    address 192.168.244.20
    netmask 255.255.255.0
EOF

Have br-eth3 come up on boot:

sed -i '/^exit 0$/i ifup br-eth3' /etc/rc.local

Up eth3 and br-eth3 and add an IP address to br-eth3:

ip link set eth3 up

ip link set br-eth3 up

ip address add 192.168.244.20/24 dev br-eth3

Add eth3 to the br-eth3 Open vSwitch Bridge:

ovs-vsctl add-port br-eth3 eth3

CentOS Network Configuration

Down eth3 and delete its IP address:

ip link set eth3 down

ip address delete 192.168.244.20/24 dev eth3

Open /etc/sysconfig/network-scripts/ifcfg-eth3, delete all the contents, and copy and paste the following:

DEVICE=eth3
BOOTPROTO=none
NM_CONTROLLED=no
ONBOOT=yes
TYPE=OVSPort
DEVICETYPE="ovs"
OVS_BRIDGE=br-eth3
IPV6INIT=no
USERCTL=no

Create /etc/sysconfig/network-scripts/ifcfg-br-eth3 and copy and paste the following:

DEVICE=br-eth3
ONBOOT=yes
BOOTPROTO=none
STP=off
NM_CONTROLLED=no
HOTPLUG=no
DEVICETYPE=ovs
TYPE=OVSBridge
IPADDR=192.168.244.20
NETMASK=255.255.255.0

Up eth3 and br-eth3 and add an IP address to br-eth3:

ip link set eth3 up

ip link set br-eth3 up

ip address add 192.168.244.20/24 dev br-eth3

Add eth3 to the br-eth3 Open vSwitch Bridge:

ovs-vsctl add-port br-eth3 eth3

Setup the compute1 Node

Log into your compute1 node:

vagrant ssh compute1

Login as the root user and stay logged in as root throughout this process (the root password is vagrant):

su -

Run chef-client (installation time will partly depend on your internet connection):

chef-client

If chef-client ran successfully, you should now have a working compute node.

The remaining steps in this section are optional, but if you want to fully utilize Neutron Networking and have internet access from your OpenStack Instances, you will need reconfigure eth3 so it can be attached to the Open vSwitch Bridge.

Follow the steps in one of the following two sections that matches the operating system you installed Rackspace Private Cloud on top of.

Ubuntu Network Configuration

Down eth3 and delete its IP address:

ip link set eth3 down

ip address delete 192.168.244.30/24 dev eth3

In /etc/network/interfaces, find auto eth3 and remove that line and the next three lines:

sed -i -e '/auto eth3/,+3d' /etc/network/interfaces

Append the new eth3 configuration to /etc/network/interfaces:

cat << 'EOF' >> /etc/network/interfaces
auto eth3
iface eth3 inet manual
    up ip link set eth3 up
    down ip link set eth3 down
     
iface br-eth3 inet static
    address 192.168.244.30
    netmask 255.255.255.0
EOF

Have br-eth3 come up on boot:

sed -i '/^exit 0$/i ifup br-eth3' /etc/rc.local

Up eth3 and br-eth3 and add an IP address to br-eth3:

ip link set eth3 up

ip link set br-eth3 up

ip address add 192.168.244.30/24 dev br-eth3

Add eth3 to the br-eth3 Open vSwitch Bridge:

ovs-vsctl add-port br-eth3 eth3

CentOS Network Configuration

Down eth3 and delete its IP address:

ip link set eth3 down

ip address delete 192.168.244.30/24 dev eth3

Open /etc/sysconfig/network-scripts/ifcfg-eth3, delete all the contents, and copy and paste the following:

DEVICE=eth3
BOOTPROTO=none
NM_CONTROLLED=no
ONBOOT=yes
TYPE=OVSPort
DEVICETYPE="ovs"
OVS_BRIDGE=br-eth3
IPV6INIT=no
USERCTL=no

Create /etc/sysconfig/network-scripts/ifcfg-br-eth3 and copy and paste the following:

DEVICE=br-eth3
ONBOOT=yes
BOOTPROTO=none
STP=off
NM_CONTROLLED=no
HOTPLUG=no
DEVICETYPE=ovs
TYPE=OVSBridge
IPADDR=192.168.244.30
NETMASK=255.255.255.0

Up eth3 and br-eth3 and add an IP address to br-eth3:

ip link set eth3 up

ip link set br-eth3 up

ip address add 192.168.244.30/24 dev br-eth3

Add eth3 to the br-eth3 Open vSwitch Bridge:

ovs-vsctl add-port br-eth3 eth3

Next Steps

At this point Rackspace Private Cloud v4.2.x powered by OpenStack Havana should be installed. Now what?

See the Spinning Up Your First Instance on Rackspace Private Cloud using Quantum/Neutron Networking post for the next steps to follow.

References

Installing OpenStack With Rackspace Private Cloud Tools



comments powered by Disqus