Example of a load balancing topology

Example of a load balancing topologyΒΆ

After you enable Octavia on your new or existing OpenStack environment as described in Configure load balancing with OpenStack Octavia, create a topology for your use case. Each topology requires you to configure the load balancer, port listener, LBaaS pool, and, optionally, the Health Monitor with a specific set of parameters.

For the purpose of this example, a topology for balancing traffic between two HTTP servers listening on port 80 is used. The topology includes the following parameters:

  • Backend servers 10.10.10.7 and 10.10.10.29 in the private-subnet subnet run an HTTP application that listens on the TCP port 80.
  • The public-subnet subnet is a shared external subnet created by the cloud operator which is accessible from the Internet.
  • You must create a load balancer accessible by an IP address from public-subnet that will be responsible for distributing web requests between the backend servers.

For more examples, see: OpenStack Octavia documentation

Caution

Starting the OpenStack Queens release, use only the OpenStack Octavia client. For details, see OpenStack Queens documentation.

Workflow:

  1. Log in to a controller node.

  2. Create a load balancer:

    neutron lbaas-loadbalancer-create --name lb1 private-subnet
    
  3. Create an HTTP listener:

    neutron lbaas-listener-create --name listener1 --loadbalancer \
    lb1 --protocol HTTP --protocol-port 80
    
  4. Create a LBaaS pool that will be used as default for listener1:

    neutron lbaas-pool-create --name pool1 --lb-algorithm \
    ROUND_ROBIN --listener listener1 --protocol HTTP
    
  5. Create a health monitor that ensures health of the pool members:

    neutron lbaas-healthmonitor-create --delay 5 --name hm1 --timeout \
    3 --max-retries 4 --type HTTP --pool pool1
    
  6. Add backend servers 10.10.10.7 and 10.10.10.29 to the pool:

    neutron lbaas-member-create --subnet private-subnet --address \
    10.10.10.7 --protocol-port 80 --name member1 pool1
    neutron lbaas-member-create --subnet private-subnet --address \
    10.10.10.29 --protocol-port 80 --name member2 pool1
    
  7. Create a floating IP address in a public network and associate it with a port of the load balancer VIP:

    vip_port_id=$(neutron lbaas-loadbalancer-show lb1 -c vip_port_id -f \
    value)
    fip_id=$(neutron floatingip-create admin_floating_net -c id -f value)
    neutron floatingip-associate $fip_id $vip_port_id
    
  8. Access the VIP floating IP address and verify that requests are distributed between the two servers.

    Example:

    $ curl http://172.24.4.14:80
    Welcome to addr:10.10.10.7
    
    $ curl http://172.24.4.14:80
    Welcome to addr:10.10.10.29
    

    In the example above, an HTTP application that runs on the backend servers returns an IP address of the host on which it runs.