Skip to main content

Load Balancer configuration

This page covers the day-to-day operation of Octavia load balancers on UNIQCloud: how each configuration option is set, the full create-to-delete lifecycle, and how to troubleshoot a load balancer that is not behaving.

For what the service is and which listener type to choose, see Load Balancer.

CLIENT IP PASS-THROUGH (PROXY PROTOCOL)

To ensure the client IP address is passed through to the backend servers, you must configure the PROXY protocol (v2) on the listener. This is critical for applications that rely on the client's IP for logging, security, or session persistence.

Note that the backend servers must also be configured to parse the PROXY protocol header to extract the client IP.


Configuration Options​

1. Session Persistence​

Session persistence ensures that requests from the same client are always routed to the same backend server. The following types are supported:

  • SOURCE_IP: Persistence based on the client's source IP address.
  • HTTP_COOKIE: Persistence using HTTP cookies.
  • APP_COOKIE: Persistence using application cookies.

Example: Enable Session Persistence for a Pool​

openstack loadbalancer pool create \
--name my-pool \
--lb-algorithm ROUND_ROBIN \
--listener <listener-id> \
--protocol HTTP \
--session-persistence type=SOURCE_IP

2. High Availability (HA)​

The Load Balancer supports active/standby and active/active HA configurations. HA is enabled by default for most deployments.

Example: Create an HA Load Balancer​

openstack loadbalancer create \
--name my-ha-lb \
--vip-subnet-id <subnet-id> \
--provider octavia \
--availability-zone nova

3. Load Balancing Algorithms​

The following algorithms are supported for distributing traffic among backend servers:

AlgorithmDescription
ROUND_ROBINDistributes requests sequentially across the backend servers.
LEAST_CONNECTIONSSends requests to the backend server with the fewest active connections.
SOURCE_IPUses a hash of the client's source IP to determine the backend server.
URIUses a hash of the request URI to determine the backend server.
HTTP_HEADERUses a hash of a specified HTTP header to determine the backend server.

Example: Set Algorithm for a Pool​

openstack loadbalancer pool create \
--name my-pool \
--lb-algorithm LEAST_CONNECTIONS \
--listener <listener-id> \
--protocol HTTP

4. Listener Types​

A listener defines the port and protocol for incoming traffic to the load balancer. The following listener types are supported:

Listener TypeProtocolPortUse Case
TCPTCPAnyGeneric TCP load balancing (databases, custom applications).
HTTPHTTP80Web traffic without encryption.
HTTPSHTTPS443Encrypted web traffic (end-to-end encryption).
TERMINATED_HTTPSHTTPS443Encrypted web traffic where the load balancer terminates SSL/TLS.
UDPUDPAnyUDP-based applications (DNS, VoIP).

Example: Create a Listener​

# Create an HTTP listener
openstack loadbalancer listener create \
--name my-http-listener \
--protocol HTTP \
--protocol-port 80 \
--loadbalancer <lb-id>

# Create a TERMINATED_HTTPS listener (SSL termination)
openstack loadbalancer listener create \
--name my-https-listener \
--protocol TERMINATED_HTTPS \
--protocol-port 443 \
--loadbalancer <lb-id> \
--default-tls-container-ref <tls-container-id>

5. PROXY Protocol (v2) Configuration​

To ensure the client IP address is passed through to backend servers, configure the PROXY protocol (v2) on the listener:

openstack loadbalancer listener set \
--proxy-protocol \
<listener-id>

Complete Management Lifecycle​

Create a Load Balancer with HTTP Listener and Pool​

# Step 1: Create a load balancer
openstack loadbalancer create \
--name my-lb \
--vip-subnet-id <subnet-id> \
--provider octavia

# Step 2: Create an HTTP listener with PROXYv2 enabled
openstack loadbalancer listener create \
--name my-http-listener \
--protocol HTTP \
--protocol-port 80 \
--loadbalancer <lb-id>

openstack loadbalancer listener set \
--proxy-protocol \
<listener-id>

# Step 3: Create a pool with ROUND_ROBIN algorithm
openstack loadbalancer pool create \
--name my-pool \
--lb-algorithm ROUND_ROBIN \
--listener <listener-id> \
--protocol HTTP

# Step 4: Add backend servers (members) to the pool
openstack loadbalancer member create \
--name member1 \
--address <server-ip-1> \
--protocol-port 80 \
--subnet-id <subnet-id> \
--pool <pool-id>

openstack loadbalancer member create \
--name member2 \
--address <server-ip-2> \
--protocol-port 80 \
--subnet-id <subnet-id> \
--pool <pool-id>

# Step 5: Enable session persistence for the pool
openstack loadbalancer pool set \
--session-persistence type=SOURCE_IP \
<pool-id>

Delete a Load Balancer and Its Resources​

# Step 1: Delete members from the pool
openstack loadbalancer member delete <member-id-1>
openstack loadbalancer member delete <member-id-2>

# Step 2: Delete the pool
openstack loadbalancer pool delete <pool-id>

# Step 3: Delete the listener
openstack loadbalancer listener delete <listener-id>

# Step 4: Delete the load balancer
openstack loadbalancer delete <lb-id>

# Alternative: Force delete a load balancer and all cascading resources
openstack loadbalancer delete --cascade <lb-id>

CLI Querying & Troubleshooting​

Use the following table to debug common issues with Load Balancer instances:

IssuePossible CauseSolution
Load balancer stuck in PENDING_CREATEInsufficient resources or network issuesCheck logs and ensure sufficient quotas.
Listener fails to createInvalid protocol or portVerify the protocol and port are supported.
Backend servers not receiving trafficIncorrect member configurationCheck member IPs, ports, and security groups.
Session persistence not workingMisconfigured persistence typeVerify the persistence type and backend support.
Client IP not visible to backendPROXY protocol not enabledEnable PROXYv2 on the listener and configure backend to parse it.
# List all load balancers
openstack loadbalancer list

# Show details of a specific load balancer
openstack loadbalancer show <lb-id>