Este contenido no está disponible en el idioma seleccionado.
Chapter 10. Creating other kinds of load balancers
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.
10.1. Creating a TCP load balancer Copiar enlaceEnlace copiado en el portapapeles!
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
- A shared external (public) subnet that you can reach from the internet.
Procedure
Source your credentials file.
Example
source ~/overcloudrc
$ source ~/overcloudrc
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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 --wait
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a
TCP
listener (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 lb1
Copy 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 TCP
Copy 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 are recommended but not required. 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 pool1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the back-end servers (
192.0.2.10
and192.0.2.11
) on the private subnet (private_subnet
) to the pool.Example
In this example, the back-end servers,
192.0.2.10
and192.0.2.11
, are namedmember1
andmember2
, 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 pool1
Copy 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 lb1
Copy 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 pool1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow A working member (
member1
) has anONLINE
value for itsoperating_status
.Example
openstack loadbalancer member show pool1 member1
$ openstack loadbalancer member show pool1 member1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.2. Creating a UDP load balancer with a health monitor Copiar enlaceEnlace copiado en el portapapeles!
You can create a 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
- 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
Source your credentials file.
Example
source ~/overcloudrc
$ source ~/overcloudrc
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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 --wait
Copy 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 lb1
Copy 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 UDP
Copy 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 are recommended but not required. 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 pool1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the back-end servers (
192.0.2.10
and192.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
and192.0.2.11
, are namedmember1
andmember2
, 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 pool1
Copy 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 lb1
Copy 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 member1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow A working member (
member1
) has anONLINE
value for itsoperating_status
.Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.3. Creating a QoS-ruled load balancer Copiar enlaceEnlace copiado en el portapapeles!
You can apply a Red Hat OpenStack Platform (RHOSP) 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
- A shared external (public) subnet that you can reach from the internet.
- A QoS policy that contains bandwidth limit rules created for the RHOSP Networking service.
Procedure
Source your credentials file.
Example
source ~/overcloudrc
$ source ~/overcloudrc
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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-bandwidth
Copy 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 --wait
Copy 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 lb1
Copy 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 HTTP
Copy 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 are recommended but not required. 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 / \ pool1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add load balancer members (
192.0.2.10
and192.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
and192.0.2.11
, are namedmember1
andmember2
, 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 pool1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
View and verify the listener (
listener1
) settings.Example
openstack loadbalancer list
$ openstack loadbalancer list
Copy 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.
10.4. Creating a load balancer with an access control list Copiar enlaceEnlace copiado en el portapapeles!
You can create an access control list (ACL) to limit incoming traffic to a 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
- A shared external (public) subnet that you can reach from the internet.
Procedure
Source your credentials file.
Example
source ~/overcloudrc
$ source ~/overcloudrc
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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 --wait
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a listener (
listener1
) with the allowed CIDRs (192.0.2.0/24
and198.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 lb1
Copy 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 TCP
Copy 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 are recommended but not required. 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 / pool1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add load balancer members (
192.0.2.10
and192.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
and192.0.2.11
, are namedmember1
andmember2
, 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 pool1
Copy 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 listener1
Copy 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_cidrs
list; 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 out
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.5. Creating an OVN load balancer Copiar enlaceEnlace copiado en el portapapeles!
You can use the Red Hat OpenStack Platform (RHOSP) client to create a load balancer that manages network traffic in your RHOSP deployment. The RHOSP Load-Balancing service supports the neutron Modular Layer 2 plug-in with the Open Virtual Network mechanism driver (ML2/OVN).
Prerequisites
The ML2/OVN provider driver must be deployed.
ImportantThe OVN provider only supports Layer 4 TCP and UDP network traffic and the
SOURCE_IP_PORT
load balancer algorithm. The OVN provider does not support health monitoring.- A shared external (public) subnet that you can reach from the internet.
Procedure
Source your credentials file.
Example
source ~/overcloudrc
$ source ~/overcloudrc
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a load balancer (
lb1
) on the private subnet (private_subnet
) using the--provider ovn
argument.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 --wait
Copy 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 lb1
Copy 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 tcp
Copy 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.10
and192.0.2.11
) on the private subnet (private_subnet
) to the pool.Example
In this example, the back-end servers,
192.0.2.10
and192.0.2.11
, are namedmember1
andmember2
, 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 pool1
Copy 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 lb1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
openstack loadbalancer listener show
command to view the listener details.Example
openstack loadbalancer listener show listener1
$ openstack loadbalancer listener show listener1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
openstack loadbalancer pool show
command to view the pool (pool1
) and load-balancer members.Example
openstack loadbalancer pool show pool1
$ openstack loadbalancer pool show pool1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow