Chapter 8. Creating non-secure HTTP load balancers You can create the following load balancers for non-secure HTTP network traffic: Section 8.1, "Creating an HTTP load balancer with a health monitor" Section 8.2, "Creating an HTTP load balancer that uses a floating IP" Section 8.3, "Creating an HTTP load balancer with session persistence" 8.1. Creating an HTTP load balancer with a health monitor For networks that are not compatible with Red Hat OpenStack Platform Networking service (neutron) floating IPs, create a load balancer to manage network traffic for non-secure HTTP applications. Create a health monitor to ensure that your back-end members remain available. Prerequisites A shared external (public) subnet that you can reach from the internet. Procedure Source your credentials file. Example Create a load balancer ( lb1 ) on a public subnet ( public_subnet ). Note Values inside parentheses are sample values that are used in the example commands in this procedure. Substitute these sample values with values that are appropriate for your site. Example Create a listener ( listener1 ) on a port ( 80 ). Example Verify the state of the listener. Example Before going to the step, ensure that the status is ACTIVE . Create the listener default pool ( pool1 ). Example Create a health monitor ( healthmon1 ) of type ( HTTP ) on the pool ( pool1 ) that connects to the back-end servers and tests the path ( / ). Health checks are recommended but not required. If no health monitor is defined, the member server is assumed to be ONLINE . Example Add load balancer members ( 192.0.2.10 and 192.0.2.11 ) on the private subnet ( private_subnet ) to the default pool. Example In this example, the back-end servers, 192.0.2.10 and 192.0.2.11 , are named member1 and member2 , respectively: Verification View and verify the load balancer (lb1) settings: Example Sample output When a health monitor is present and functioning properly, you can check the status of each member. A working member ( member1 ) has an ONLINE value for its operating_status . Example Sample output Additional resources loadbalancer in the Command Line Interface Reference 8.2. Creating an HTTP load balancer that uses a floating IP To manage network traffic for non-secure HTTP applications, create a load balancer with a virtual IP (VIP) that depends on a floating IP. The advantage of using a floating IP is that you retain control of the assigned IP, which is necessary if you need to move, destroy, or recreate your load balancer. It is a best practice to also create a health monitor to ensure that your back-end members remain available. Note Floating IPs do not work with IPv6 networks. Prerequisites A floating IP to use with a load balancer VIP. A Red Hat OpenStack Platform Networking service (neutron) shared external (public) subnet that you can reach from the internet to use for the floating IP. Procedure Source your credentials file. Example Create a load balancer ( lb1 ) on a private subnet ( private_subnet ). Note Values inside parentheses are sample values that are used in the example commands in this procedure. Substitute these sample values with values that are appropriate for your site. Example In the output from step 2, record the value of load_balancer_vip_port_id , because you must provide it in a later step. Create a listener ( listener1 ) on a port ( 80 ). Example Create the listener default pool ( pool1 ). Example The command in this example creates an HTTP pool that uses a private subnet containing back-end servers that host non-secure HTTP applications on TCP port 80: Create a health monitor ( healthmon1 ) of type ( HTTP ) on the pool ( pool1 ) that connects to the back-end servers and tests the path ( / ). Health checks are recommended but not required. If no health monitor is defined, the member server is assumed to be ONLINE . Example Add load balancer members ( 192.0.2.10 and 192.0.2.11 ) on the private subnet to the default pool. Example In this example, the back-end servers, 192.0.2.10 and 192.0.2.11 , are named member1 and member2 , respectively: Create a floating IP address on the shared external subnet ( public ). Example In the output from step 8, record the value of floating_ip_address , because you must provide it in a later step. Associate this floating IP ( 203.0.113.0 ) with the load balancer vip_port_id ( 69a85edd-5b1c-458f-96f2-b4552b15b8e6 ). Example Verification Verify HTTP traffic flows across the load balancer by using the floating IP ( 203.0.113.0 ). Example Sample output When a health monitor is present and functioning properly, you can check the status of each member. A working member ( member1 ) has an ONLINE value for its operating_status . Example Sample output Additional resources loadbalancer in the Command Line Interface Reference floating in the Command Line Interface Reference 8.3. Creating an HTTP load balancer with session persistence To manage network traffic for non-secure HTTP applications, you can create load balancers that track session persistence. Doing so ensures that when a request comes in, the load balancer directs subsequent requests from the same client to the same back-end server. Session persistence optimizes load balancing by saving time and memory. Prerequisites A shared external (public) subnet that you can reach from the internet. The non-secure web applications whose network traffic you are load balancing have cookies enabled. Procedure Source your credentials file. Example Create a load balancer ( lb1 ) on a public subnet ( public_subnet ). Note Values inside parentheses are sample values that are used in the example commands in this procedure. Substitute these sample values with values that are appropriate for your site. Example Create a listener ( listener1 ) on a port ( 80 ). Example Create the listener default pool ( pool1 ) that defines session persistence on a cookie ( PHPSESSIONID ). Example The command in this example creates an HTTP pool that uses a private subnet containing back-end servers that host non-secure HTTP applications on TCP port 80: Create a health monitor ( healthmon1 ) of type ( HTTP ) on the pool ( pool1 ) that connects to the back-end servers and tests the path ( / ). Health checks are recommended but not required. If no health monitor is defined, the member server is assumed to be ONLINE . Example Add load balancer members ( 192.0.2.10 and 192.0.2.11 ) on the private subnet ( private_subnet ) to the default pool. Example In this example, the back-end servers, 192.0.2.10 and 192.0.2.11 , are named member1 and member2 , respectively: Verification View and verify the load balancer ( lb1 ) settings: Example Sample output When a health monitor is present and functioning properly, you can check the status of each member. A working member ( member1 ) has an ONLINE value for its operating_status . Example Sample output Additional resources loadbalancer in the Command Line Interface Reference

Commands:
source ~/overcloudrc
openstack loadbalancer create --name lb1 --vip-subnet-id public_subnet --wait
openstack loadbalancer listener create --name listener1 --protocol HTTP --protocol-port 80 lb1
openstack loadbalancer listener show listener1
openstack loadbalancer pool create --name pool1 --lb-algorithm ROUND_ROBIN --listener listener1 --protocol HTTP
openstack loadbalancer healthmonitor create --name healthmon1 --delay 15 --max-retries 4 --timeout 10 --type HTTP --url-path / pool1
openstack loadbalancer member create --name member1 --subnet-id private_subnet --address 192.0.2.10 --protocol-port 80 pool1 openstack loadbalancer member create --name member2 --subnet-id private_subnet --address 192.0.2.11 --protocol-port 80 pool1
openstack loadbalancer show lb1
+---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | admin_state_up | True | | created_at | 2022-01-15T11:11:09 | | description | | | flavor | | | id | 788fe121-3dec-4e1b-8360-4020642238b0 | | listeners | 09f28053-fde8-4c78-88b9-0f191d84120e | | name | lb1 | | operating_status | ONLINE | | pools | 627842b3-eed8-4f5f-9f4a-01a738e64d6a | | project_id | dda678ca5b1241e7ad7bf7eb211a2fd7 | | provider | amphora | | provisioning_status | ACTIVE | | updated_at | 2022-01-15T11:12:13 | | vip_address | 198.51.100.12 | | vip_network_id | 9bca13be-f18d-49a5-a83d-9d487827fd16 | | vip_port_id | 69a85edd-5b1c-458f-96f2-b4552b15b8e6 | | vip_qos_policy_id | None | | vip_subnet_id | 5bd7334b-49b3-4849-b3a2-b0b83852dba1 | +---------------------+--------------------------------------+
openstack loadbalancer member show pool1 member1
+---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | address | 192.0.2.10 | | admin_state_up | True | | created_at | 2022-01-15T11:16:23 | | id | b85c807e-4d7c-4cbd-b725-5e8afddf80d2 | | name | member1 | | operating_status | ONLINE | | project_id | dda678ca5b1241e7ad7bf7eb211a2fd7 | | protocol_port | 80 | | provisioning_status | ACTIVE | | subnet_id | 5bd7334b-49b3-4849-b3a2-b0b83852dba1 | | updated_at | 2022-01-15T11:20:45 | | weight | 1 | | monitor_port | None | | monitor_address | None | | backup | False | +---------------------+--------------------------------------+
source ~/overcloudrc
openstack loadbalancer create --name lb1 --vip-subnet-id private_subnet --wait
openstack loadbalancer listener create --name listener1 --protocol HTTP --protocol-port 80 lb1
openstack loadbalancer pool create --name pool1 --lb-algorithm ROUND_ROBIN --listener listener1 --protocol HTTP
openstack loadbalancer healthmonitor create --name healthmon1 --delay 15 --max-retries 4 --timeout 10 --type HTTP --url-path / pool1
openstack loadbalancer member create --name member1 --subnet-id private_subnet --address 192.0.2.10 --protocol-port 80 pool1 openstack loadbalancer member create --name member2 --subnet-id private_subnet --address 192.0.2.11 --protocol-port 80 pool1
openstack floating ip create public
openstack floating ip set --port 69a85edd-5b1c-458f-96f2-b4552b15b8e6 203.0.113.0
curl -v http://203.0.113.0 --insecure
* About to connect() to 203.0.113.0 port 80 (#0) * Trying 203.0.113.0 * Connected to 203.0.113.0 (203.0.113.0) port 80 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.29.0 > Host: 203.0.113.0 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 30 < * Connection #0 to host 203.0.113.0 left intact
openstack loadbalancer member show pool1 member1
+---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | address | 192.0.02.10 | | admin_state_up | True | | created_at | 2022-01-15T11:11:23 | | id | b85c807e-4d7c-4cbd-b725-5e8afddf80d2 | | name | member1 | | operating_status | ONLINE | | project_id | dda678ca5b1241e7ad7bf7eb211a2fd7 | | protocol_port | 80 | | provisioning_status | ACTIVE | | subnet_id | 5bd7334b-49b3-4849-b3a2-b0b83852dba1 | | updated_at | 2022-01-15T11:28:42 | | weight | 1 | | monitor_port | None | | monitor_address | None | | backup | False | +---------------------+--------------------------------------+
source ~/overcloudrc
openstack loadbalancer create --name lb1 --vip-subnet-id public_subnet --wait
openstack loadbalancer listener create --name listener1 --protocol HTTP --protocol-port 80 lb1
openstack loadbalancer pool create --name pool1 --lb-algorithm ROUND_ROBIN --listener listener1 --protocol HTTP --session-persistence type=APP_COOKIE,cookie_name=PHPSESSIONID
openstack loadbalancer healthmonitor create --name healthmon1 --delay 15 --max-retries 4 --timeout 10 --type HTTP --url-path / pool1
openstack loadbalancer member create --name member1 --subnet-id private_subnet --address 192.0.2.10 --protocol-port 80 pool1 openstack loadbalancer member create --name member2 --subnet-id private_subnet --address 192.0.2.11 --protocol-port 80 pool1
openstack loadbalancer show lb1
+---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | admin_state_up | True | | created_at | 2022-01-15T11:11:58 | | description | | | flavor | | | id | 788fe121-3dec-4e1b-8360-4020642238b0 | | listeners | 09f28053-fde8-4c78-88b9-0f191d84120e | | name | lb1 | | operating_status | ONLINE | | pools | 627842b3-eed8-4f5f-9f4a-01a738e64d6a | | project_id | dda678ca5b1241e7ad7bf7eb211a2fd7 | | provider | amphora | | provisioning_status | ACTIVE | | updated_at | 2022-01-15T11:28:42 | | vip_address | 198.51.100.22 | | vip_network_id | 9bca13be-f18d-49a5-a83d-9d487827fd16 | | vip_port_id | 69a85edd-5b1c-458f-96f2-b4552b15b8e6 | | vip_qos_policy_id | None | | vip_subnet_id | 5bd7334b-49b3-4849-b3a2-b0b83852dba1 | +---------------------+--------------------------------------+
openstack loadbalancer member show pool1 member1
+---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | address | 192.0.02.10 | | admin_state_up | True | | created_at | 2022-01-15T11:11:23 | | id | b85c807e-4d7c-4cbd-b725-5e8afddf80d2 | | name | member1 | | operating_status | ONLINE | | project_id | dda678ca5b1241e7ad7bf7eb211a2fd7 | | protocol_port | 80 | | provisioning_status | ACTIVE | | subnet_id | 5bd7334b-49b3-4849-b3a2-b0b83852dba1 | | updated_at | 2022-01-15T11:28:42 | | weight | 1 | | monitor_port | None | | monitor_address | None | | backup | False | +---------------------+--------------------------------------+