Load Balancing as a Service (LBaaS) is an advanced OpenStack Neutron networking service that provides load balancing for multi-node environments. It spreads incoming requests across multiple servers to reduce the load on nodes used for busy websites and in shared hosting environments to deliver content to users more quickly. The Fuel tool, an open source, GUI-driven deployment and management tool for OpenStack, supports community projects and plugins, including an LBaaS plugin, so in this article we’re going to take a brief look at how to make that work.
In this article, we cover the following steps for enabling LBaaS:
Downloading and installing the LBaaS plugin for the Fuel tool
Creating a cluster with LBaaS enabled via Fuel
Configuring your LBaaS cluster with Horizon
Testing your load balancer
Let’s begin with installation.
Download and install the LBaaS plugin for Fuel
To install the LBaaS plugin and enable the service, you need to start in a clean environment that does not have an operating system or OpenStack installed. See the Quick Start Guide for directions on downloading scripts and launching OpenStack. Then continue with the steps in the guide to launch Fuel, which will enable you to use the LBaaS plugin.
When you’ve launched Fuel, you can download and install the LBaaS plugin for Fuel using information found on the Fuel Plugins wiki, completing the following steps:
Download the plugin from the Fuel Plugins Catalog, running:
Copy the plugin to the Fuel Master node with secure copy by running:
# scp lbaas-1.0.0.fp root@:<the_Fuel_Master_node_IP_address>:/tmp
Install with the following commands on the Fuel Master node:
# cd /tmp
# fuel plugins –install lbaas-1.0.0.fp
- When complete, you see the output: “Plugin lbaas-1.0.0.fp was successfully installed.”
Create a cluster with LBaaS via Fuel
When you’ve installed the LBaaS plugin, you need to create a cluster with LBaaS using Fuel. Follow the next several steps to complete this task:
Choose to create a new environment. In the wizard, make the following choices:
Juno on Ubuntu as your operating system
Now select “Multi-node” in the interface.
Neutron with VLAN segmentation for “Networking Setup”
Once you’ve completed the wizard, activate the plugin by clicking the Settings tab selecting the “LBaaS plugin for Neutron” checkbox. Be sure to press “Save Settings” as shown in Figure 1.
On the “Nodes” tab, add a controller and at least one compute node.
Click “Configure Interfaces” and place the Admin network on one NIC, and the Private, Public, Management, and Storage networks on a second, as in Figure 2. (See the Mirantis OpenStack User Guide for more information on dealing with interfaces.)
Click the “Networks” tab and specify your network configuration. Save the changes and click “Verify Networks,” to complete network verification testing. After a few moments, you should see a message that says “Verification succeeded. Your network is configured correctly.”
Press “Deploy Changes” in the upper right-hand corner and confirm your choices.
When OpenStack has been installed, Fuel generates a success message on the “LBaaS” screen as seen in Figure 3. In that message, click the link to Horizon, which is the OpenStack dashboard.
Using the Horizon interface to configure LBaaS
Now that you have created an OpenStack cluster with LBaaS, you’ll need to configure it. You can do that in Horizon using these steps:
Create a new project with a member user called lbaas-user-1. (See detailed instructions on creating a project.)
Create a new network using private IP addresses. (See detailed instructions on creating a network.) Choose “UP” as the admin state.
Create a subnet for the network, as in Figure 4.
See more details on using Horizon for these tasks.
Figure 4: Create subnet
5. Select the “Enable DHCP” checkbox in the “Subnet Detail” tab and enter values for the following fields as shown in Figure 5:
Figure 5: Subnet detail
Create a new pool for the Load Balancer
With the network established, you now create a new pool/subnet for the load balancer. The pool includes devices such as web servers grouped together to process traffic. Load balancing designates which member of the pool handles new requests or connection from the Virtual IP (VIP) address. Each VIP has one pool. Requests to the pool look something like Figure 6.
Figure 6: Load Balancer and the IP pool
To create the new pool, complete the following steps:
On the left-hand menu of the Horizon dashboard, click “Network” under the “Project” option, then select “Load Balancers” to create a new pool of IP addresses — a subnet — by clicking “Add Pool”.
Specify that the new pool should use the same subnet you used to create the network. Choose the appropriate protocol (such as http for web requests) and Load Balancing Method (such as ROUND_ROBIN, which basically passes each incoming request to the next server down the line), as in Figure 7.
Figure 7: Add Pool
Next add a Virtual IP (VIP), the IP address users will use to access the pool. Select the pool under the “Pools” tab on the “Load Balancer” page and select “Add VIP” from the “Edit Pool” drop-down menu.
Complete the “Add VIP” form, keeping the following in mind:
For the VIP subnet, use the subnet created with the network
In our case, we have no Session Persistence; your application may be different, of course.
Connection limit is a number that sets a connection limit on the VIP or on the pool. Beyond this number, the load balancing function refuses client requests or connections. To accept an unlimited number of simultaneous connections, set this limit to -1.
Admin state should be set to the UP state
Create and configure a router for network access
In order to access the network, you’ll need to create a router. You can review complete instructions on creating and using an OpenStack Networking router, but following are the basic instructions:
Create a new router under Project->Network->Routers.
Select the new router and choose “Set Gateway” in the “Action” drop-down. The gateway should use the public-facing external network as the External Network. The name, ID, and IP address will be allocated automatically.
Click “Add Interface” for the router and specify the same subnet you’ve been using all along; the gateway address will be chosen automatically from that subnet.
You can verify that the gateway is set up correctly by selecting Network->Projects->Network Topology. You should see a display something like Figure 8.
Set access and security
In order for users to access the pool, they’ll need to know what IP address to call; this will come from the Floating IP address pool.
Under the project’s “Access & Security” tab, allocate a floating IP from the subnet you’ve been using thus far.
Under the “Actions” drop-down for the new floating IP, select “Associate”. Match the new floating IP to the VIP you created earlier, as in Figure 9.
Now the network topology looks like that shown in Figure 10:
Add load balanced instances to the pool
So now that you’ve got a pool of IP addresses and a floating IP to sit above them, you’ll need instances for them to point to. Let’s do that now.
Under Access & Security, create a keypair to use for accessing instances.
Launch four identical instances by choosing Project->Instances->Launch Instance and setting the Instance Count to 4. Be sure to set the network to the subnet created earlier, and to specify the keypair under the Access & Security tab.
Choose Project->Network->Load Balancers->Members->+Add Member.
Specify the pool you created earlier, and “Select from active instances” for the “Member Source”. Set the weight as 1, so that all instances get the same amount of traffic. You can see an example in Figure 11.
At this point you should have a functioning load balancer; let’s test it out.
Testing your load balancer
Now you are ready for the last big installation task, which is to run a simple test of the load balancer.
Create a simple web server
The first thing you’ll need is a way to respond to user requests. In this case we just want to create a very simple web server that responds with the server number.
For each instance, log in via the Virtual Network Computing (VNC) console or an SSH client (using the SSH keys you created earlier).
For each instance, run the following command to create a very simple web server. Make sure to set the correct server number for each instance.
while true; do echo -e ‘HTTP/1.0 200 OK\r\n\r\nserver-1’ | sudo nc -l -p 80 ; done
Test LBaaS with the following command, which just makes an HTTP call to the floating IP every half second.
while true; do wget -O – http://172.16.0.131 && sleep 0.5 ; done
After running the command, you should see that each subsequent access to port 80 on your public IP for LBaaS will be handled by the next server according to the Round Robin algorithm, as in Figure 12.
Now that you know it’s working, you can deploy any software or service, as appropriate.
You’ve got LBaaS, you lucky devil!
In this case, we’ve created a load balancer that just responds to a simple HTTP request, but you can use this method to create a pool of any type of service.
If you’d like more information, check out the Fuel Plugins documentation.
You’ll find the effort of installing the plugin more than worth it as LBaaS distributes requests across multiple servers, greatly expediting content delivery and improving the experience of your websites and hosting environments.
Disclaimer: LBaaS plugins compatible with Fuel 6.0 and 6.1 are not supported for customer deployments due to the limitations of the community solution, including no failover of load-balanced objects or HTTPS termination. Mirantis will review capabilities of the project in the community again in advance of each Fuel release. Unsupported plugins are published to DriverLog.