Deploying a cloud solution like OpenStack is hard. You have to install different services on different server, perform many different functions to orchestrate the cloud. It is a common question for those who wants to deploy OpenStack that how to start? How can I ensure that everything is in order or every component is working? Think about an environment where you can build your cloud with multiple units and test some basic function on that cloud like to create instances, upload images, configure security group etc on your laptop? Sounds good right. In Ubuntu 16.04 version you can do this, you can build a basic OpenStack cloud with just pressing some enter key. We will see it shortly, but before start, let’s have a quick introduction about OpenStack cloud and the underlying tools to install the cloud.
Quick Introduction
OpenStack:
OpenStack is a free and open-source software platform for cloud computing, mostly deployed as an infrastructure-as-a-service (IaaS). OpenStack is written in python. It has many components and each of them has a code name. Like Neutron, Cinder, Nova, Horizon, Keystone, Glance, Swift etc. For more information about OpenStack you can visit their site.
Juju:
Juju is an open source application modelling tool developed by Canonical Ltd, the company behind Ubuntu. Juju focuses on reducing the operational overhead of today’s software by facilitating quickly deploying, configuring, scaling, integrating, and performing operational tasks on a wide choice of public and private cloud services along with bare metal servers and local container based deployments. (Wikipedia). You don’t need any expertise about juju to perform this step just follow it. Juju will do the thing in the background. if you want to know more abut juju you can find it here.
Conjure-up:
Conjure-up is another project of canonical and available on Ubuntu Xenial (16.04) and above. So what conjure-up do? With the help of juju conjure-up will do the actual magic in this lab. They said that if you want to deploy a big software use conjure-up. We will see the conjure-up magic soon. if you want to know about conjure-up you can find it here.
LXD:
LXD is the new LXC (Linux container) experience. It offers a completely fresh and intuitive user experience with a single command line tool to manage your containers. You can test lxd online here. For more about lxd click here. Again, this will also be created in the background by juju. If you are new with LXD don’t worry just follow the lab.
ZFS:
zfs is a combined file system and a logical volume manager. We will create a zfs pool here and the whole cloud will be installed in that pool. We will see it in the lab. you can find more about zfs here.
Enough introduction, now lets start the lab. For these labs I use Ubuntu 16.04.1 LTS (Xenial Xerus) 64bit desktop image. If you have 16GB ram and 200GB SSD drive, then it will run very smoothly. You can also perform the lab in the Vmware esxi host. Make a vm host and install Xenial Xerus desktop version. My intention is to build the cloud in a desktop/laptop environment but, you can also use a server version of Ubuntu 16.04 OS.
Start Building the cloud
Login to your Ubuntu desktop and perform the following:
imtiaz@devstack:~$ sudo apt update imtiaz@devstack:~$ sudo apt upgrade
Install the zfs and lxd
imtiaz@devstack:~$ sudo apt install zfs lxd
After finish lets make a reboot
imtiaz@devstack:~$ sudo reboot
Login to your ubuntu desktop again and check that your login user is in the lxd group using the groups command. if not, then add the user to the lxd group. LXD includes an interactive initialization which includes setting up a ZFS pool and appropriate networking for your LXD containers. To start this process, type the below command and press enter:
imtiaz@devstack:~$ sudo lxd init
You will be asked several questions to configure LXD for use.
Name of the storage backend to use (dir or zfs): zfs Create a new ZFS pool (yes/no)? yes Name of the new ZFS pool: OpenStack Would you like to use an existing block device (yes/no)? no Size in GB of the new loop device (1GB minimum): 100 Would you like LXD to be available over the network (yes/no)? no Do you want to configure the LXD bridge (yes/no)? yes
After choosing yes and pressing enter another screen will pops up like below. (Click on the images to see a better version of that image)
It actually asks you to create the network bridge for the containers. Select yes and press enter.
Give a name of the interface bridge or you can choose the default value and press enter
Press yes. This will create an IPv4 subnet which will be used by our containers.
Now this will create a random subnet for containers. Just check that it’s not overlapping with your already exist subnets. If it’s not match with your current subnet, then it’s good to just select the default.
Press enter
Leave it default (24) and press enter
Subnet address for containers will be provided from the internal dhcp server so you don’t need to create a dhcp server. It’s showing that what will be the first dhcp address. Leave it as it is and press enter.
And then the last address. Again press enter.
Max number of dhcp clients. We actually don’t need that much address but for simplicity just press enter.
Press yes.
Press no for IPv6 connectivity.
Now our bridge is created. Now perform the following for initialized our containers.
imtiaz@devstack:~$ lxc finger imtiaz@devstack:~$ lxc list
After lxc list You will find an empty list like bellow.
imtiaz@devstack:~$ lxc list +----------------+---------+----------------------+------+ | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | +----------------+---------+----------------------+------+
After this we now install the require package for building the cloud. Perform the bellow steps one after another. First install the python-software-properties.
imtiaz@devstack:~$ sudo apt-get install python-software-properties
Add the required ppa for, OpenStack, juju and conjure-up.
imtiaz@devstack:~$ sudo add-apt-repository ppa:cloud-installer/stable imtiaz@devstack:~$ sudo apt-add-repository ppa:juju/stable imtiaz@devstack:~$ sudo apt-add-repository ppa:conjure-up/next
Update your apt list
imtiaz@devstack:~$ sudo apt-get update
Start installing the package one after another.
imtiaz@devstack:~$ sudo apt install openstack imtiaz@devstack:~$ sudo apt install juju
Now our required package is installed. Now we will start building our cloud. Type the below command in your terminal window.
imtiaz@devstack:~$ conjure-up openstack
After pressing enter you will see the below screen pops up in your terminal. Its better to make the terminal in Maximize state for better view.
Select “OpenStack with NovaLXD” and press enter.
Leave it to default and press enter.
Now this screen is showing the component which will be installed for running the OpenStack cloud. Select “Deploy all 15 Remaining Applications” and press enter. Grab a cup of tea or coffee and watch the progress. This will take 30 to 60 minutes to complete all the steps. Your job is now just watching the progress.
First, it will bootstrap juju (create the controller. The controller manages both the environment and the models you create to host the applications. ), copy all required images and so many activities.
Now, after finishing the bootstrapping you will see a similar screen like above. The required container has been created and now juju is deploying the application in those containers. In the left column of the screen you will see some states like maintenance, waiting, blocked all are OK. Just wait and keep watching the show. To see the container, open a new terminal and type the below command in your new terminal.
imtiaz@devstack:~$ lxc list +----------------+---------+----------------------+------+------------+-----------+ | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | +----------------+---------+----------------------+------+------------+-----------+ | juju-76f9ca-0 | RUNNING | 10.45.239.218 (eth0) | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-0 | RUNNING | 10.45.239.219 (eth0) | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-1 | RUNNING | 10.45.239.171 (eth0) | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-10 | RUNNING | | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-11 | RUNNING | 10.45.239.48 (eth0) | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-12 | RUNNING | | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-13 | RUNNING | | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-14 | RUNNING | 10.45.239.208 (eth0) | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-15 | RUNNING | | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-2 | RUNNING | 10.45.239.150 (eth0) | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-3 | RUNNING | 10.45.239.246 (eth0) | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-4 | RUNNING | 10.45.239.18 (eth0) | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-5 | RUNNING | 10.45.239.120 (eth0) | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-6 | RUNNING | 10.45.239.64 (eth0) | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-7 | RUNNING | 10.45.239.193 (eth0) | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-8 | RUNNING | 10.45.239.10 (eth0) | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ | juju-9a0712-9 | RUNNING | 10.45.239.186 (eth0) | | PERSISTENT | 0 | +----------------+---------+----------------------+------+------------+-----------+ imtiaz@devstack:~$
As you can see that lots of containers has been created for us and each of them has their IPv4 address set. Some of them are blank its mean they are waiting for their IP address. To populate the list again perform the above command again. If you see that the IPv4 column is still blank (after 10 to 15 mins later) then just reboot the container. For rebooting the container perform the below steps. Say for example “juju-9a0712-15” is still waiting for it’s IPv4 address. login to the container like below
imtiaz@devstack:~$ lxc exec juju-9a0712-15 bash root@juju-9a0712-15:~# reboot
That will reboot the container. wait for some time and populate the list again like above, this time you will see an IPv4 address is assigned to the container. Back to the show again.
This time you will see that some applications are deployed which is showing “Unit is ready“, just below the application and there is a green tick mark at left, and at right side its showing “active” state. Some are “blocked” with a red flag, some are in “maintenance” state with a blue circle and some are waiting with a blue hour glass. All are valid and the show is still going on. After some time you will see that all of your units are in ready state. But i face one situation that one or two node are still in waiting state like below.
When I took the screen shot I have two container/node in “waiting for machine” state and it will remain in this state if you don’t do anything. The reason for this is because the container workload is reached to its maximum value. to increase the value just perform the following steps and wait for some time, you will see your container hour glass sign will change and it will start working.
imtiaz@devstack:~$ sysctl fs.inotify fs.inotify.max_queued_events = 16384 fs.inotify.max_user_instances = 128 fs.inotify.max_user_watches = 8192 imtiaz@devstack:~$ imtiaz@devstack:~$ sudo sysctl fs.inotify.max_user_instances=512 imtiaz@devstack:~$ sysctl fs.inotify fs.inotify.max_queued_events = 16384 fs.inotify.max_user_instances = 512 fs.inotify.max_user_watches = 8192 imtiaz@devstack:~$
Now after some time you will see a screen like below where your stuck container will start working
Wait for another couple of minutes and you will see all your units will be in ready state like below images.
Now you can see that all your units are ready. Wait until you see the next screen.
Now in this stage there are four steps to perform. Don’t worry, you just only need to press enter. First, it will import the images which will be used to create the instances on the cloud, import or create the ssh key for those instances, configure the networking for the cloud an finally it will give you a link with user name and password for accessing the cloud. Select “Run” and press enter. Look at the bottom of the screen, wait until the step finished. Then perform another step. After finishing all the step you will see a screen like below.
Now open a web browser from your laptop and insert the link provided on the screen.
You will see an OpenStack dashboard code name horizon. Use the username and password (by default it’s “admin” and “openstack” in Newton release) for accessing the cloud. I’ll introduce the OpenStack dashboard code name horizon and other components of OpenStack in my next post. We will create instances and will login to that instances from our laptop. That’s all for today.
Thanks for reading the post. If you enjoyed the post, please share it with your network and let me know your thoughts in the comments.
About the Author: Imtiaz is working in a financial organization in Bangladesh and having experience in system, network and security administration. Feel free to contact with him on LinkedIn or Twitter.
Thanks!!
how i can deploy it assign the roles it to physical servers?
Basically i want do it with 4 severs
thanks great how to!
thank you mr rahman
i used your installation document
but this line :
imtiaz@devstack:~$ sudo add-apt-repository ppa:cloud-installer/stable
is deprecated
when you prepare part 2?
great guide, thanks – helped a lot. FYI i had to install conjure-up with “sudo apt install conjure-up”, other than that it all went as described