Private Cloud Load balancer — Openstack

Openstack is a great open source private cloud solution, which enables you to manage your infrastructure optimally and efficiently. When we are trying to achieve high availability in openstack it is essential that we have a robust load balancing solution. In configuring for high availability, the load balancer would sit between the consumer (internet or intranet) and the server cluster, routing incoming traffic to backend servers using various methods like round robin, least connections and source IP.

When considering load balancer installation in openstack I evaluated two options.

- Neutron Load balancer as a service

- Octavia Load balancer

But neutron load balancer is no longer maintained. According to queens openstack release cycle, neutron load balancer is deprecated. Therefore our choice was Octavia load balancer.

What is Octavia?

Octavia is an open source, operator scale load balancing solution designed to work with openstack. You can find the Octavia architecture and more details from https://docs.openstack.org/octavia/latest/reference/introduction.html

This guide describes the steps for setting up the Octavia load balancer. In this example my configuration is openstack(queens version) on CentOS7.

Octavia Installation and Configuration

Install the following packages on openstack server from yum install command.

After that start the following services for online Octavia.

Check all the service status

Create MySQL database for Octavia

Create mysql database for octavia. This database keeps all the details related to load balancers. The database owner is octavia user.

The main configuration file is /etc/octavia/octavia.conf. Therefore all the relevant parameters need to be changed in the file.

The Sample Configuration file

Create octavia.conf file with the following parameters.

Restart the services.

Now you check all the logs related to Octavia to make sure all the services are up and running without an error.

Log Files Location: /var/log/Octavia

Log Files:

- api.log

- worker.log

- health-manager.log

- housekeeping.log

If all success, Congratulations! You have installed Octavia successfully.

What is Amphora:

The component of Octavia that does the load balancing is known as amphora.

Amphora may be a virtual machine, may be a container, or may run on bare metal.

Amphora will need a base image that can be deployed by Octavia to provide load balancing service.

Amphora Image Create:

The disk-image-create script and other elements will build Amphora image. The script will be able to use Ubuntu or CentOS or Fedora as a base OS. I faced an issue when I create an image using centos base image on CentOS7 server.

Therefore I used a separate Ubutnu Desktop 16.04 for create an amphora image.

Pre requites for create Amphora image on Ubuntu:

Git Clone Octavia and disk-image create repos.

Export ENV variables:

You should install disk-image builder via pip.

Example: creates virtual env and install pip:

Then the script will create amphora-x64-haproxy.qcow2 image successfully. The image base OS is Ubuntu.

Then transfer the image to /tmp on openstack server using scp for sftp.

Upload Amphora Image to openstack and create the image:

Upload the image to Openstack

Use openstack CLI for image upload.

Check the images list once you done the image create.

Check the image status. If the status is active you can proceed rest of steps.

Steps to create an octavia load balancer :

· Use Octavia CLI for create the load balancers.

Check the load balancer from LB list

· Create Listener for Load balancer — with port 80

· Create pool for the listener

· Add member to pool:

· Add health monitor for the pool:

List available floating IPs:

Check the available floating IP from openstack floating ip list command.

Get the VIP port ID for assign floating IP:

· Assign the Floating IP to LB:

· Check the load balancer status:

Once done the LB create you can ssh to loadbalancer :

Then you can check HAProxy logs from /var/log/haproxy.log

Congratulations! You have configured Octavia Load balancer successfully.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store