Karan Singh

Where there's a Cloud , there's a way !!

Deploying OpenStack KILO Using RDO

| Comments

Deploying OpenStack KILO using RDO

Getting openstack up and running using RDO is fairly straight forward. However many people have asked to deploy openstack with an existing external network. This method should allow any machine on the network to be able to access launched instances via their floating IPs.

Environment

  • CentOS7
  • OpenStack RDO KILO
  • Vagrant ( Optional )

In this demo , we will use Vagrant to spin up two CentOS7 VM’s node1 and node2. You can also use your other machines or even your physical servers.

Step 1 - Creating virtual machines for OpenStack deployment

  • Get my version of Vagrantfile
1
# wget https://gist.githubusercontent.com/ksingh7/85d887b92a448a042ca8/raw/372be2527bad24045b3a1764dee31e91074ecb50/Vagrantfile --output-document=Vagrantfile
  • Bring up virtual machines using Vagrant
1
# vagrant up node1 node2
  • Once both machines are UP , ssh into them followed by sudo su -

Step 2 - Setting up OpenStack nodes

  • On both the nodes disable CentOS7 network manager and update CentOS7 packages
1
# systemctl stop NetworkManager;systemctl disable NetworkManager;chkconfig network on;systemctl start network;yum update -y

Step 3 - Setting up RDO

  • On node1 setup RDO repositories and install packstack
1
# yum install -y https://rdoproject.org/repos/rdo-release.rpm ; yum install -y openstack-packstack

Step 4 - Modify Packstack answerfile

  • Next generate packsack answer file , by keeping some unrelevant options disabled and enabling neutron ML2 plugins.
1
2
3
4
5
6
7
packstack \
--provision-demo=n  \
--nagios-install=n \
--os-swift-install=n \
--os-ceilometer-install=n \
--os-neutron-ml2-type-drivers=vxlan,flat,vlan \
--gen-answer-file=answerfile.cfg
  • Edit answerfile.cfg to add IP addresses of CONTROLLER, COMPUTE, NETWORK, STORAGE and databases.
1
2
3
4
5
6
7
CONFIG_CONTROLLER_HOST=10.0.1.10
CONFIG_COMPUTE_HOSTS=10.0.1.10,10.0.1.11
CONFIG_NETWORK_HOSTS=10.0.1.10
CONFIG_STORAGE_HOST=10.0.1.10
CONFIG_AMQP_HOST=10.0.1.10
CONFIG_MARIADB_HOST=10.0.1.10
CONFIG_MONGODB_HOST=10.0.1.10
  • Next edit answerfile.cfg to add public and private interface names
1
2
3
CONFIG_NOVA_COMPUTE_PRIVIF=enp0s9
CONFIG_NOVA_NETWORK_PUBIF=enp0s8
CONFIG_NOVA_NETWORK_PRIVIF=enp0s9
  • Since we have multiple nodes to deploy openstack on, lets setup SSH between nodes.
1
2
3
# ssh-keygen
# ssh-copy-id [email protected]
# ssh-copy-id [email protected]

Step 5 - Installing OpenStack

  • Finally start deploying openstack
1
# packstack --answer-file=answerfile.cfg
  • Once deployment is completed
    • Get you openstack username and password from keystonerc_admin file # cat keystonerc_admin
    • Point your web browser to http://10.0.1.10/dashboard and login to openstack dashboard
    • You can also source keystonerc_admin file to use openstack CLI
1
2
# source keystonerc_admin
# openstack server list

Step 6 - Configure OVS external bridge ( for floating IP )

  • Create OVS bridge interface by creating file /etc/sysconfig/network-scripts/ifcfg-br-ex with the following contents
1
2
3
4
5
6
7
8
9
DEVICE=br-ex
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=static
IPADDR=10.0.1.10   # IP address of enp0s8 interface
NETMASK=255.255.255.0
GATEWAY=10.0.1.1
DNS1=8.8.8.8
ONBOOT=yes
  • Configure enp0s8 for OVS bridging by editing /etc/sysconfig/network-scripts/ifcfg-enp0s8 and adding the following content
1
2
3
4
5
DEVICE=enp0s8
TYPE=OVSPort
DEVICETYPE=ovs
OVS_BRIDGE=br-ex
ONBOOT=yes
  • Modify neutron plugin to define a logical name for our external physical L2 segment as “extnet”
1
# openstack-config --set /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini ovs bridge_mappings extnet:br-ex
  • Restart networking services
1
2
3
# service network restart
# service neutron-openvswitch-agent restart
# service neutron-server restart

Step 7 - Create OpenStack networks for Instances

  • Create Public ( External ) network
1
# neutron net-create public_network --provider:network_type flat --provider:physical_network extnet  --router:external --shared
  • Create Public ( External ) network subnet
1
# neutron subnet-create --name public_subnet --enable_dhcp=False --allocation-pool=start=10.0.1.100,end=10.0.1.110 --gateway=10.0.1.1 public_network 10.0.1.0/24 --dns-nameservers list=true 8.8.8.8 4.2.2.2
  • Create Private ( Tenent ) network
1
# neutron net-create private_network
  • Create Private ( Tenent ) network subnet
1
# neutron subnet-create --name private_subnet private_network 10.15.15.0/24
  • Create Router
1
# neutron router-create router1
  • Set Router gateway as public network
1
# neutron router-gateway-set router1 public_network
  • Set Router interface as private network subnet
1
# neutron router-interface-add router1 private_subnet
  • At this point you have configured openstack networks and your network topology should look like

Deploying OpenStack KILO using RDO

Step 8 - Launch Instance

  • Add a glance image
1
# curl http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img | glance image-create --name='cirros image' --is-public=true  --container-format=bare --disk-format=qcow2
  • From openstack dashboard

    • Add key pair Projects --> Compute --> Access & Security --> Key Pairs --> Import Key Pair
      • Key Pair Name –> node1_key
      • Public Key –> Contents of # cat /root/.ssh/id_rsa.pub
    • Create security groups rules for ICMP and SSH Projects --> Compute --> Access & Security --> security groups --> default --> manage rules Deploying OpenStack KILO using RDO
  • Launch Instance

    • Get Private_Network ID using # openstack network list
    • Create instance ( replace net-id from network id that got from above ) # openstack server create --image="cirros image" --flavor=m1.tiny --key-name=node1 --nic net-id="288f9b1f-7453-4132-9dd4-8829a6844d73" Demo_Instance
    • Check instance status # openstack server list

Step 9 - Accessing Instance

  • From openstack dashboard assign floating ip to instance Projects --> Compute --> Instances --> Actions --> Associate Floating IP
  • Ping this floating ip address from node1 # ping 10.0.1.101
  • SSH into demo_instance # ssh [email protected] Deploying OpenStack KILO using RDO

Tadaa … you are Done !!! Play around, create several instances and test them against your workloads ;-)

Comments