-
Notifications
You must be signed in to change notification settings - Fork 0
packstack tutorial
This is a quick tutorial for setting up OpenStack environment on your development machine. We will be using Packstack tool which is able to setup ALL the OpenStack Mitaka components (as opposed to DevStack that is unable to setup Newtron and some other components).
The setup is quite simple, yet it should take you about an hour.
Following this tutorial you will end up with Virtualbox VM that:
- will have CentOS 7 operating system with or without GUI (we've opted-in for non-GUI)
- will be consuming about 4 GB disk on fresh install and will require 6 GB RAM
- will have a single network adapter attached (bridged type). VM will be able to access internet thru this adapter and also OpenStack will allocate Floating Ips that will be reachable from your local network thru this adapter. This means that you will be able to ping/ssh to OpenStack instances by their floating IP from any device connected to your physical router.
- will have OpenStack Mitaka installed and working with all of its components (Horizon will be accessible at http://{centos-vm-ip}/dashboard also from your host system)
-
CentosVM
refers to Virtualbox VM with CentOS 7 operating system where the OpenStack is installed. -
{centos-ip}
refers to the static IP ofCentosVM
. In my case it was 192.168.0.26. -
{centos-gw}
refers to default gateway ofCentosVM
. This is where your physical router is. In my case it was 192.168.0.1. -
{centos-cidr}
refers to your router's CIDR. In my case it was 192.168.0.0/24. -
{floating-ip-start}
,{floating-ip-end}
refers to IP range where OpenStack should assign Floating Ips in. This range needs to be within your{centos-cidr}
, but outside of your router's DHCP range. In my case it was 192.168.0.200,192.168.0.240.
- Create Virtualbox VM with CentOS guest
- Install packstack
- Install OpenStack Mitaka using packstack
- Configure br-ex network bridge
- Create OpenStack networks using neutron
- Test
We will not go into details here. Use Virtualbox GUI to create new VM. Use "Linux" type and "Red Hat (64-bit)" version, 100GB vdi HDD and install CentOS 7 on it (core packages are enough).
NETWORKING: let VM have one "Bridged Adapter". It is important that you set it's Promiscouous Mode to "Allow All" in order to be able to access OpenStack instances from outside the CentOS VM.
This VM is what we refer to as CentosVM
and it's IP is what we refer to as {centos-ip}
. Make sure that IP will persist. In our case it was done by adding a static MAC-to-IP mapping to the DHCP server (using router's GUI).
Add following entries to the /etc/environment:
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
Disable NetworkManager:
sudo systemctl disable firewalld
sudo systemctl stop firewalld
sudo systemctl disable NetworkManager
sudo systemctl stop NetworkManager
sudo systemctl enable network
sudo systemctl start network
Install packstack:
sudo yum install -y centos-release-openstack-mitaka
sudo yum update -y
sudo yum install -y openstack-packstack
This command will take a while (10min or so):
packstack --allinone --provision-demo=n --os-neutron-ovs-bridge-mappings=extnet:br-ex --os-neutron-ovs-bridge-interfaces=br-ex:eth0 --os-neutron-ml2-type-drivers=vxlan,flat,vlan,local ## --os-heat-install=y --nova-libvirt-virt-type=kvm
If you were running this command via ssh terminal, the session will probably be dropped at some point. Not sure if it's needed, but we've reconnected then and run the command again and the session was not aborted.
Once the installation completes, you will have OpenStack up and running. Go ahead, browse http://{centos-ip}
/dashboard to be sure everything was ok. You'll find admin password in $HOME/keystonerc_admin file.
You can stop reading tutorial at this point if you need no networking for your instances.
Add a new file /etc/sysconfig/network-scripts/ifcfg-br-ex with the following content:
DEVICE=br-ex
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=static
IPADDR={centos-ip}
NETMASK=255.255.255.0
GATEWAY={centos-gw}
DNS1={centos-gw}
ONBOOT=yes
Replace everything in {...}
with appropriate values (see Definitions section above).
You also need to overwrite your main adapter settings. Replace your content of /etc/sysconfig/network-scripts/ifcfg-enp0s3 with:
DEVICE=enp0s3
TYPE=OVSPort
DEVICETYPE=ovs
OVS_BRIDGE=br-ex
ONBOOT=yes
Viola! Reboot CentosVM
to apply changes.
You need to add appropriate OpenStack models to the database so that you will be able to access network from Horizon dashboard:
source keystonerc_admin
neutron net-create external_network --provider:network_type flat --provider:physical_network extnet --router:external
neutron subnet-create --name public_subnet --enable_dhcp=False --allocation-pool=start={floating-ip-start},end={floating-ip-end} --gateway={centos-gw} external_network {centos-cidr}
Create non-admin OpenStack user that will be spinning-out instances:
openstack project create --enable internal
openstack user create --project internal --password pass --email bar@corp.com --enable internal
Go to Horizon dashboard to obtain her openrc.sh (Project->Access & Security->API Access->Download OpenStack RC File v2.0). Create private network using her credentials:
source internal-openrc.sh
neutron router-create router1
neutron router-gateway-set router1 external_network
neutron net-create private_network
neutron subnet-create --name private_subnet private_network 10.10.100.0/24
neutron router-interface-add router1 private_subnet
Viola! OpenStack Mitaka is now up-and-running and able to run instances that are accessible from anywhere inside your local network.
Upload a test image:
source keystonerc_admin
curl http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img | glance image-create --name='cirros image' --visibility=public --container-format=bare --disk-format=qcow2
Then visit Horizon dashboard at http://{centos-ip}/dashboard and login with internal/pass. Launch a new instance from cirros image. Pick "private_network" in Networks section. The instance should go to Power State "Running".
You need to modify your default security group before you can access the instance. Add the ICMP rule (for ping, 8/8) and SSH rule.
Then go to Project->Access & Security->Floating IPs and allocate a new IP. Associate it with your instance. If everything is OK, you should be able to:
- ssh cirros@{floating-ip} from the
CentosVM
- ssh cirros@{floating-ip} from any PC that is connected to your home router
You are ready to run OSv unikernel on your brand new OpenStack.
This tutorial was written based on: