Load Balancer as a Service

LBaaS is a Neutron extension that introduces a software Load Balancer, which balances network traffic between a group of multiple server instances.

This tutorial will show you how to create a Load Balancer with floating IP that balances traffic between two web servers on private network.

First of all we need to prepare our environment.

  • private network (we use 10.1.1.0/24 in this tutorial)
  • router with external network connectivity
  • two web server instances

The following post-creation code automatically provisions an Apache web server with page containing server’s host name.

#cloud-config
packages:
    - apache2
runcmd:
    - mv /var/www/html/index.html /var/www/html/index.html.bak
    - hostname > /var/www/html/index.html

Now we can create a pool of server for our Load Balancer.

OpenStack Load Balancer as a Service Pool

We will add our servers to this pool.

OpenStack Load Balancer as a Service Members

To prevent Load Balancer from directing traffic to inactive instances we will add a monitor.

OpenStack Load Balancer as a Service Monitor

After that we can assign private network IP address to our Load Balancer.

OpenStack Load Balancer as a Service Virtual IP

And finally we have to assign a floating IP to make this Load Balancer reachable from Internet network:

OpenStack Load Balancer as a Service VIP Floating IP

This is how our new Load Balancer looks like.

OpenStack Load Balancer as a Service Complete

If you have provisioned server instances with post-creation code from the top of this tutorial, you can see host name switching on a web page at address of our Load Balancer depending on which one of our servers handles the request.

Last modified: 0001-01-01