Always within the part relating to the Network, we find the Load Balancer (LB). It was preferred to relegate it to a separate sub-chapter, since it is a somewhat broader topic than the other components that make up the network. Please note that load balancing is handled by the OpenStack Octavia module (the main OpenStack modules are listed here).
At a high level, load balancing is typically accomplished by having a load balancer or set of load balancers present on a virtual server to a set of clients. This virtual server is backed by a pool of “real” servers that provide some type of resource to those clients. The role of the load balancer is to distribute client requests across the pool of servers including rerouting requests when a member of the pool fails. Clients are not aware which “real” server in the pool are servicing their requests, since they are only aware of the virtual server presented by the load balancer. By leveraging load balancers, client requests can be serviced in such a way as to mitigate against bottlenecks, due to resource contention on any given server or against failed requests due to failures on any given servers. The former use case is what is often considered scaling out while the latter is about creating a fault tolerant service. The canonical example is the use of load balancers in front of a pool of web servers, to serve out web pages to incoming clients via the internet.
Create a Load Balancer
Log in to the OpenStack dashboard.
On the Project tab, open the Network tab, and click the Load Balancers category.
Click the Create Load Balancer button.
Here we illustrate, through some screenshots, how to fill in the required fields, according to a typical LB configuration. In general, use the usual legend present in the tabs (represented by the question mark) to fill in the necessary information about the LB you want to create.
Load Balancer Details tab
This introductory tab is fairly intuitive. Note that if you don't enter any IP address, the system will generate it for you.
Listener Details tab
Each port that listens for traffic on a particular load balancer is configured separately and tied to the load balancer. Multiple listeners can be associated with the same load balancer. Enter the name and HTTP protocol. Leave the values in the timeout fields below unchanged for now.
Pool Details tab
This object representing the grouping of members to which the listener forwards client requests. Note that a pool is associated with only one listener, but a listener might refer to several pools (and switch between them, as we will see later, using layer 7 policies). Assign a name to the Pool and choose the method with which the incoming requests will be distributed. We can choose between 3 algorithms:
- Round robin: rotates requests evenly between multiple instances.
- Source IP: requests from a unique source IP address are consistently directed to the same instance.
- Least connections: allocates requests to the instance with the least number of active connections.
Pool Members tab
This object representing a single back-end server or system that is a part of a pool. A member is associated with only one pool. Hence, select from the list below the VMs, which will have to make up the pool, and add the port on which they are listening.
Monitor Details tab
Members may go offline from time to time and health monitors diverts traffic away from members that are not responding properly. Health monitors are associated with pools. We assign a name, choose the HTTP type and, leaving the default values on the other parameters, we create, therefore, our LB.
Associate Floating IP
After creating the LB, we assign a FIP. Then click on Associate Floating IP and, in the screen that appears, select a free FIP to associate with the LB.
Delete a Load Balancer
Log in to the OpenStack dashboard.
On the Project tab, open the Network tab, and click the Load Balancers category.
- Select the load balancer you want to delete and click the Delete Load Balancer button.
To be deleted successfully, a load balancer must not have any listeners or pools associated with it.