Chapter 9. Creating other kinds of load balancers
In Red Hat OpenStack Services on OpenShift (RHOSO) environments, you use the Load-balancing service (octavia) to create the type of load balancer that matches the type of non-HTTP network traffic that you want to manage:
9.1. Creating a TCP load balancer Copy linkLink copied to clipboard!
You can create a load balancer when you need to manage network traffic for non-HTTP, TCP-based services and applications. It is a best practice to also create a health monitor to ensure that your back-end members remain available.
Prerequisites
-
The administrator has created a project for you and has provided you with a
clouds.yamlfile for you to access the cloud. The
python-openstackclientpackage resides on your workstation.dnf list installed python-openstackclient
$ dnf list installed python-openstackclientCopy to Clipboard Copied! Toggle word wrap Toggle overflow - A shared external (public) subnet that you can reach from the internet.
Procedure
Confirm that the system
OS_CLOUDvariable is set for your cloud:echo $OS_CLOUD
$ echo $OS_CLOUD my_cloudCopy to Clipboard Copied! Toggle word wrap Toggle overflow Reset the variable if necessary:
export OS_CLOUD=my_other_cloud
$ export OS_CLOUD=my_other_cloudCopy to Clipboard Copied! Toggle word wrap Toggle overflow As an alternative, you can specify the cloud name by adding the
--os-cloud <cloud_name>option each time you run anopenstackcommand.Create a load balancer (
lb1) on the public subnet (public_subnet).NoteValues 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
openstack loadbalancer create --name lb1 \ --vip-subnet-id public_subnet --wait
$ openstack loadbalancer create --name lb1 \ --vip-subnet-id public_subnet --waitCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a
TCPlistener (listener1) on the specified port (23456) for which the custom application is configured.- Example
openstack loadbalancer listener create --name listener1 \ --protocol TCP --protocol-port 23456 lb1
$ openstack loadbalancer listener create --name listener1 \ --protocol TCP --protocol-port 23456 lb1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a pool (
pool1) and make it the default pool for the listener.- Example
In this example, a pool is created that uses a private subnet containing back-end servers that host a custom application on a specific TCP port:
openstack loadbalancer pool create --name pool1 \ --lb-algorithm ROUND_ROBIN --listener listener1 \ --protocol TCP
$ openstack loadbalancer pool create --name pool1 \ --lb-algorithm ROUND_ROBIN --listener listener1 \ --protocol TCPCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a health monitor (
healthmon1) on the pool (pool1) that connects to the back-end servers and probes the TCP service port.- Example
Health checks can help to avoid a false positive. If no health monitor is defined, the member server is assumed to be
ONLINE.openstack loadbalancer healthmonitor create --name healthmon1 \ --delay 15 --max-retries 4 --timeout 10 --type TCP pool1
$ openstack loadbalancer healthmonitor create --name healthmon1 \ --delay 15 --max-retries 4 --timeout 10 --type TCP pool1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Add the back-end servers (
192.0.2.10and192.0.2.11) on the private subnet (private_subnet) to the pool.- Example
In this example, the back-end servers,
192.0.2.10and192.0.2.11, are namedmember1andmember2, respectively:openstack loadbalancer member create --name member1 --subnet-id \ private_subnet --address 192.0.2.10 --protocol-port 443 pool1 openstack loadbalancer member create --name member2 --subnet-id \ private_subnet --address 192.0.2.11 --protocol-port 443 pool1
$ openstack loadbalancer member create --name member1 --subnet-id \ private_subnet --address 192.0.2.10 --protocol-port 443 pool1 $ openstack loadbalancer member create --name member2 --subnet-id \ private_subnet --address 192.0.2.11 --protocol-port 443 pool1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
View and verify the load balancer (
lb1) settings.- Example
openstack loadbalancer show lb1
$ openstack loadbalancer show lb1Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
When a health monitor is present and functioning properly, you can check the status of each member. Use the following command to obtain a member ID:
- Example
openstack loadbalancer member list pool1
$ openstack loadbalancer member list pool1Copy to Clipboard Copied! Toggle word wrap Toggle overflow A working member (
member1) has anONLINEvalue for itsoperating_status.- Example
openstack loadbalancer member show pool1 member1
$ openstack loadbalancer member show pool1 member1Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
9.2. Creating a UDP load balancer with a health monitor Copy linkLink copied to clipboard!
You can create a Red Hat OpenStack Services on OpenShift (RHOSO) load balancer when you need to manage network traffic on UDP ports. It is a best practice to also create a health monitor to ensure that your back-end members remain available.
Prerequisites
-
The administrator has created a project for you and has provided you with a
clouds.yamlfile for you to access the cloud. The
python-openstackclientpackage resides on your workstation.dnf list installed python-openstackclient
$ dnf list installed python-openstackclientCopy to Clipboard Copied! Toggle word wrap Toggle overflow - A shared external (public) subnet that you can reach from the internet.
- No security rules that block ICMP Destination Unreachable messages (ICMP type 3).
Procedure
Confirm that the system
OS_CLOUDvariable is set for your cloud:echo $OS_CLOUD
$ echo $OS_CLOUD my_cloudCopy to Clipboard Copied! Toggle word wrap Toggle overflow Reset the variable if necessary:
export OS_CLOUD=my_other_cloud
$ export OS_CLOUD=my_other_cloudCopy to Clipboard Copied! Toggle word wrap Toggle overflow As an alternative, you can specify the cloud name by adding the
--os-cloud <cloud_name>option each time you run anopenstackcommand.Create a load balancer (
lb1) on a private subnet (private_subnet).NoteValues 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
openstack loadbalancer create --name lb1 \ --vip-subnet-id private_subnet --wait
$ openstack loadbalancer create --name lb1 \ --vip-subnet-id private_subnet --waitCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a listener (
listener1) on a port (1234).- Example
openstack loadbalancer listener create --name listener1 \ --protocol UDP --protocol-port 1234 lb1
$ openstack loadbalancer listener create --name listener1 \ --protocol UDP --protocol-port 1234 lb1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create the listener default pool (
pool1).- Example
The command in this example creates a pool that uses a private subnet containing back-end servers that host one or more applications configured to use UDP ports:
openstack loadbalancer pool create --name pool1 \ --lb-algorithm ROUND_ROBIN --listener listener1 --protocol UDP
$ openstack loadbalancer pool create --name pool1 \ --lb-algorithm ROUND_ROBIN --listener listener1 --protocol UDPCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a health monitor (
healthmon1) on the pool (pool1) that connects to the back-end servers by using UDP (UDP-CONNECT).Health checks can help to avoid a false positive. If no health monitor is defined, the member server is assumed to be
ONLINE.- Example
openstack loadbalancer healthmonitor create --name healthmon1 \ --delay 5 --max-retries 2 --timeout 3 --type UDP-CONNECT pool1
$ openstack loadbalancer healthmonitor create --name healthmon1 \ --delay 5 --max-retries 2 --timeout 3 --type UDP-CONNECT pool1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Add the back-end servers (
192.0.2.10and192.0.2.11) on the private subnet (private_subnet) to the default pool.- Example
In this example, the back-end servers,
192.0.2.10and192.0.2.11, are namedmember1andmember2, respectively:openstack loadbalancer member create --name member1 --subnet-id \ private_subnet --address 192.0.2.10 --protocol-port 1234 pool1 openstack loadbalancer member create --name member2 --subnet-id \ private_subnet --address 192.0.2.11 --protocol-port 1234 pool1
$ openstack loadbalancer member create --name member1 --subnet-id \ private_subnet --address 192.0.2.10 --protocol-port 1234 pool1 $ openstack loadbalancer member create --name member2 --subnet-id \ private_subnet --address 192.0.2.11 --protocol-port 1234 pool1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
View and verify the load balancer (
lb1) settings.- Example
openstack loadbalancer show lb1
$ openstack loadbalancer show lb1Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
When a health monitor is present and functioning properly, you can check the status of each member.
- Example
openstack loadbalancer member show pool1 member1
$ openstack loadbalancer member show pool1 member1Copy to Clipboard Copied! Toggle word wrap Toggle overflow A working member (
member1) has anONLINEvalue for itsoperating_status.- Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
9.3. Creating a QoS-ruled load balancer Copy linkLink copied to clipboard!
You can apply a Red Hat OpenStack Services on OpenShift (RHOSO) Networking service (neutron) Quality of Service (QoS) policy to virtual IP addresses (VIPs) that use load balancers. In this way, you can use a QoS policy to limit incoming or outgoing network traffic that the load balancer can manage. It is a best practice to also create a health monitor to ensure that your back-end members remain available.
Prerequisites
-
The administrator has created a project for you and has provided you with a
clouds.yamlfile for you to access the cloud. The
python-openstackclientpackage resides on your workstation.dnf list installed python-openstackclient
$ dnf list installed python-openstackclientCopy to Clipboard Copied! Toggle word wrap Toggle overflow - A shared external (public) subnet that you can reach from the internet.
- A QoS policy that contains bandwidth limit rules created for the Networking service.
Procedure
Confirm that the system
OS_CLOUDvariable is set for your cloud:echo $OS_CLOUD
$ echo $OS_CLOUD my_cloudCopy to Clipboard Copied! Toggle word wrap Toggle overflow Reset the variable if necessary:
export OS_CLOUD=my_other_cloud
$ export OS_CLOUD=my_other_cloudCopy to Clipboard Copied! Toggle word wrap Toggle overflow As an alternative, you can specify the cloud name by adding the
--os-cloud <cloud_name>option each time you run anopenstackcommand.Create a network bandwidth QoS policy (
qos_policy_bandwidth) with a maximum 1024 kbps and a maximum burst rate of 1024 kb.NoteValues 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
openstack network qos policy create qos_policy_bandwidth openstack network qos rule create --type bandwidth-limit --max-kbps 1024 --max-burst-kbits 1024 qos-policy-bandwidth
$ openstack network qos policy create qos_policy_bandwidth $ openstack network qos rule create --type bandwidth-limit --max-kbps 1024 --max-burst-kbits 1024 qos-policy-bandwidthCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a load balancer (
lb1) on the public subnet (public_subnet) by using a QoS policy (qos-policy-bandwidth).- Example
openstack loadbalancer create --name lb1 \ --vip-subnet-id public_subnet \ --vip-qos-policy-id qos-policy-bandwidth --wait
$ openstack loadbalancer create --name lb1 \ --vip-subnet-id public_subnet \ --vip-qos-policy-id qos-policy-bandwidth --waitCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a listener (
listener1) on a port (80).- Example
openstack loadbalancer listener create --name listener1 \ --protocol HTTP --protocol-port 80 lb1
$ openstack loadbalancer listener create --name listener1 \ --protocol HTTP --protocol-port 80 lb1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
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 an HTTP application on TCP port 80:
openstack loadbalancer pool create --name pool1 --lb-algorithm ROUND_ROBIN --listener listener1 --protocol HTTP
$ openstack loadbalancer pool create --name pool1 --lb-algorithm ROUND_ROBIN --listener listener1 --protocol HTTPCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a health monitor (
healthmon1) on the pool that connects to the back-end servers and tests the path (/).Health checks can help to avoid a false positive. If no health monitor is defined, the member server is assumed to be
ONLINE.- Example
openstack loadbalancer healthmonitor create --name healthmon1 \ --delay 15 --max-retries 4 --timeout 10 --type HTTP --url-path / \ pool1
$ openstack loadbalancer healthmonitor create --name healthmon1 \ --delay 15 --max-retries 4 --timeout 10 --type HTTP --url-path / \ pool1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Add load balancer members (
192.0.2.10and192.0.2.11) on the private subnet (private_subnet) to the default pool.- Example
In this example, the back-end servers,
192.0.2.10and192.0.2.11, are namedmember1andmember2, respectively:openstack loadbalancer member create --name member1 --subnet-id \ private_subnet --address 192.0.2.10 --protocol-port 443 pool1 openstack loadbalancer member create --name member2 --subnet-id \ private_subnet --address 192.0.2.11 --protocol-port 443 pool1
$ openstack loadbalancer member create --name member1 --subnet-id \ private_subnet --address 192.0.2.10 --protocol-port 443 pool1 $ openstack loadbalancer member create --name member2 --subnet-id \ private_subnet --address 192.0.2.11 --protocol-port 443 pool1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
View and verify the listener (
listener1) settings.- Example
openstack loadbalancer list
$ openstack loadbalancer listCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this example the parameter,
vip_qos_policy_id, contains a policy ID.
9.4. Creating a load balancer with an access control list Copy linkLink copied to clipboard!
You can create an access control list (ACL) to limit incoming traffic to a Red Hat OpenStack Services on OpenShift (RHOSO) listener to a set of allowed source IP addresses. Any other incoming traffic is rejected. It is a best practice to also create a health monitor to ensure that your back-end members remain available.
Prerequisites
-
The administrator has created a project for you and has provided you with a
clouds.yamlfile for you to access the cloud. The
python-openstackclientpackage resides on your workstation.dnf list installed python-openstackclient
$ dnf list installed python-openstackclientCopy to Clipboard Copied! Toggle word wrap Toggle overflow - A shared external (public) subnet that you can reach from the internet.
Procedure
Confirm that the system
OS_CLOUDvariable is set for your cloud:echo $OS_CLOUD
$ echo $OS_CLOUD my_cloudCopy to Clipboard Copied! Toggle word wrap Toggle overflow Reset the variable if necessary:
export OS_CLOUD=my_other_cloud
$ export OS_CLOUD=my_other_cloudCopy to Clipboard Copied! Toggle word wrap Toggle overflow As an alternative, you can specify the cloud name by adding the
--os-cloud <cloud_name>option each time you run anopenstackcommand.Create a load balancer (
lb1) on the public subnet (public_subnet).NoteValues 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
openstack loadbalancer create --name lb1 --vip-subnet-id public_subnet --wait
$ openstack loadbalancer create --name lb1 --vip-subnet-id public_subnet --waitCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a listener (
listener1) with the allowed CIDRs (192.0.2.0/24and198.51.100.0/24).- Example
openstack loadbalancer listener create --name listener1 --protocol TCP --protocol-port 80 --allowed-cidr 192.0.2.0/24 --allowed-cidr 198.51.100.0/24 lb1
$ openstack loadbalancer listener create --name listener1 --protocol TCP --protocol-port 80 --allowed-cidr 192.0.2.0/24 --allowed-cidr 198.51.100.0/24 lb1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create the listener default pool (
pool1).- Example
In this example, a pool is created that uses a private subnet containing back-end servers that are configured with a custom application on TCP port 80:
openstack loadbalancer pool create --name pool1 --lb-algorithm ROUND_ROBIN --listener listener1 --protocol TCP
$ openstack loadbalancer pool create --name pool1 --lb-algorithm ROUND_ROBIN --listener listener1 --protocol TCPCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a health monitor on the pool that connects to the back-end servers and tests the path (
/).Health checks can help to avoid a false positive. If no health monitor is defined, the member server is assumed to be
ONLINE.- Example
openstack loadbalancer healthmonitor create --name healthmon1 \ --delay 15 --max-retries 4 --timeout 10 --type HTTP --url-path / pool1
$ openstack loadbalancer healthmonitor create --name healthmon1 \ --delay 15 --max-retries 4 --timeout 10 --type HTTP --url-path / pool1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Add load balancer members (
192.0.2.10and192.0.2.11) on the private subnet (private_subnet) to the default pool.- Example
In this example, the back-end servers,
192.0.2.10and192.0.2.11, are namedmember1andmember2, respectively:openstack loadbalancer member create --subnet-id private_subnet --address 192.0.2.10 --protocol-port 80 pool1 openstack loadbalancer member create --subnet-id private_subnet --address 192.0.2.11 --protocol-port 80 pool1
$ openstack loadbalancer member create --subnet-id private_subnet --address 192.0.2.10 --protocol-port 80 pool1 $ openstack loadbalancer member create --subnet-id private_subnet --address 192.0.2.11 --protocol-port 80 pool1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
View and verify the listener (
listener1) settings.- Example
openstack loadbalancer listener show listener1
$ openstack loadbalancer listener show listener1Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this example the parameter,
allowed_cidrs, is set to allow traffic only from 192.0.2.0/24 and 198.51.100.0/24.
To verify that the load balancer is secure, ensure that a request to the listener from a client whose CIDR is not in the
allowed_cidrslist; the request does not succeed.- Sample output
curl: (7) Failed to connect to 203.0.113.226 port 80: Connection timed out curl: (7) Failed to connect to 203.0.113.226 port 80: Connection timed out curl: (7) Failed to connect to 203.0.113.226 port 80: Connection timed out curl: (7) Failed to connect to 203.0.113.226 port 80: Connection timed out
curl: (7) Failed to connect to 203.0.113.226 port 80: Connection timed out curl: (7) Failed to connect to 203.0.113.226 port 80: Connection timed out curl: (7) Failed to connect to 203.0.113.226 port 80: Connection timed out curl: (7) Failed to connect to 203.0.113.226 port 80: Connection timed outCopy to Clipboard Copied! Toggle word wrap Toggle overflow
9.5. Creating an OVN load balancer Copy linkLink copied to clipboard!
You can use the OpenStack client to create a load balancer that manages network traffic in your Red Hat OpenStack Services on OpenShift (RHOSO) environment. The RHOSO Load-Balancing service supports the neutron Modular Layer 2 plug-in with the Open Virtual Network mechanism driver (ML2/OVN).
The load-balancing provider for OVN is available in this release as a Technology Preview, and therefore is not fully supported by Red Hat. It should only be used for testing, and should not be deployed in a production environment. For more information about Technology Preview features, see Scope of Coverage Details.
Prerequisites
-
The administrator has created a project for you and has provided you with a
clouds.yamlfile for you to access the cloud. The
python-openstackclientpackage resides on your workstation.dnf list installed python-openstackclient
$ dnf list installed python-openstackclientCopy to Clipboard Copied! Toggle word wrap Toggle overflow The ML2/OVN provider driver must be deployed.
ImportantThe OVN provider only supports Layer 4 TCP and UDP network traffic and the
SOURCE_IP_PORTload balancer algorithm. The OVN provider does not support health monitoring.- A shared external (public) subnet that you can reach from the internet.
Procedure
Confirm that the system
OS_CLOUDvariable is set for your cloud:echo $OS_CLOUD
$ echo $OS_CLOUD my_cloudCopy to Clipboard Copied! Toggle word wrap Toggle overflow Reset the variable if necessary:
export OS_CLOUD=my_other_cloud
$ export OS_CLOUD=my_other_cloudCopy to Clipboard Copied! Toggle word wrap Toggle overflow As an alternative, you can specify the cloud name by adding the
--os-cloud <cloud_name>option each time you run anopenstackcommand.Create a load balancer (
lb1) on the private subnet (private_subnet) using the--provider ovnargument.NoteValues 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
openstack loadbalancer create --name lb1 --provider ovn \ --vip-subnet-id private_subnet --wait
$ openstack loadbalancer create --name lb1 --provider ovn \ --vip-subnet-id private_subnet --waitCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a listener (
listener1) that uses the protocol (tcp) on the specified port (80) for which the custom application is configured.NoteThe OVN provider only supports Layer 4 TCP and UDP network traffic.
- Example
openstack loadbalancer listener create --name listener1 \ --protocol tcp --protocol-port 80 lb1
$ openstack loadbalancer listener create --name listener1 \ --protocol tcp --protocol-port 80 lb1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create the listener default pool (
pool1).NoteThe only supported load-balancing algorithm for OVN is
SOURCE_IP_PORT.- Example
The command in this example creates an HTTP pool that uses a private subnet containing back-end servers that host a custom application on a specific TCP port:
openstack loadbalancer pool create --name pool1 --lb-algorithm \ SOURCE_IP_PORT --listener listener1 --protocol tcp
$ openstack loadbalancer pool create --name pool1 --lb-algorithm \ SOURCE_IP_PORT --listener listener1 --protocol tcpCopy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantOVN does not support the health monitor feature for load-balancing.
Add the back-end servers (
192.0.2.10and192.0.2.11) on the private subnet (private_subnet) to the pool.- Example
In this example, the back-end servers,
192.0.2.10and192.0.2.11, are namedmember1andmember2, respectively: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 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 pool1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
View and verify the load balancer (
lb1) settings.- Example
openstack loadbalancer show lb1
$ openstack loadbalancer show lb1Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Run the
openstack loadbalancer listener showcommand to view the listener details.- Example
openstack loadbalancer listener show listener1
$ openstack loadbalancer listener show listener1Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Run the
openstack loadbalancer pool showcommand to view the pool (pool1) and load-balancer members.- Example
openstack loadbalancer pool show pool1
$ openstack loadbalancer pool show pool1Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow