Chapter 6. Monitoring the Load-balancing service
In Red Hat OpenStack Services on OpenShift (RHOSO) environments, to keep load balancing operational, you can use the load-balancer management network and create, modify, and delete load-balancing health monitors.
6.1. The Load-balancing service networks Copy linkLink copied to clipboard!
The Load-balancing service (octavia) controller pods require network connectivity across the OpenStack cloud to monitor and manage amphora load-balancer virtual machines (VMs) using the load-balancing networks.
The load-balancing networks are:
- octavia controller network (
octavia-provider-net) - an external provider network connecting Load-balancing service (octavia) controllers running in the control plane
- Load-balancing management network (
lb-mgmt-net) - a project (tenant) network that is connected to the amphora VMs.
An OpenStack router routes packets between the management network and the controller network with both the control plane pods and load-balancer VMs having routes configured to direct traffic through the router for those networks.
Running the following command, oc rsh openstack client openstack network list -f yaml yields output similar to the following:
- ID: 2e4fc309-546b-4ac8-9eae-aa8d70a27a9b
Name: octavia-provider-net
Subnets:
- eea45073-6e56-47fd-9153-12f7f49bc115
- ID: 77881d3f-04b0-46cb-931f-d54003cce9f0
Name: lb-mgmt-net
Subnets:
- e4ab96af-8077-4971-baa4-e0d40a16f55a
The octavia-provider-net network is the external provider network, and uses the octavia network attachment interface as the physical network. This network is limited to the OpenShift control plane. The lb-mgmt-net network is a self-serve tenant network that connects the Octavia amphora instances.
The amphora controllers do not have direct access to the lb-mgmt-net network. The controllers access the lb-mgmt-net network through the octavia network attachment and a router that the octavia-operator manages. You can view the subnets by running the command, oc rsh openstackclient subnet list -f yaml:
- ID: e4ab96af-8077-4971-baa4-e0d40a16f55a
Name: lb-mgmt-subnet
Network: 77881d3f-04b0-46cb-931f-d54003cce9f0
Subnet: 172.24.0.0/16
- ID: eea45073-6e56-47fd-9153-12f7f49bc115
Name: octavia-provider-subnet
Network: 2e4fc309-546b-4ac8-9eae-aa8d70a27a9b
Subnet: 172.23.0.0/24
The subnet CIDR for octavia-provider-subnet originates from the octavia network attachment. The Subnet CIDR of lb-mgmt-subnet originates from the dst field of the octavia network attachment routes.
The octavia-link-router manages the routing between the octavia-provider-net and lb-mgmt-net networks. To view the routers, run the command,oc rsh openstackclient openstack router list -f yaml:
- ID: 371d800c-c803-4210-836b-eb468654462a
Name: octavia-link-router
Project: dc65b54e9cba475ba0adba7f898060f2
State: true
Status: ACTIVE
You can view the configuration of the octavia-link-router by running the command, oc rsh openstackclient openstack router show -f yaml octavia-link-router:
admin_state_up: true
availability_zone_hints: []
availability_zones: []
created_at: '2024-06-11T17:20:57Z'
description: ''
enable_ndp_proxy: null
external_gateway_info:
enable_snat: false
external_fixed_ips:
- ip_address: 172.23.0.150
subnet_id: eea45073-6e56-47fd-9153-12f7f49bc115
network_id: 2e4fc309-546b-4ac8-9eae-aa8d70a27a9b
flavor_id: null
id: 371d800c-c803-4210-836b-eb468654462a
interfaces_info:
- ip_address: 172.24.1.89
port_id: 1a44e94d-f44a-4752-81db-bc5402857a08
subnet_id: e4ab96af-8077-4971-baa4-e0d40a16f55a
name: octavia-link-router
project_id: dc65b54e9cba475ba0adba7f898060f2
revision_number: 4
routes: []
status: ACTIVE
tags: []
tenant_id: dc65b54e9cba475ba0adba7f898060f2
updated_at: '2024-06-11T17:21:01Z'
The external_gateway_info of the router corresponds to the gw field of the routes provided in the network attachment.
Notice that source network address translation is disabled. This is important as the amphora controllers communicate with the amphora by using the addresses on the lb-mgmt-net network that OpenStack allocates, not a floating IP address. The routes of the network attachment direct traffic from the amphora controllers to the router, and the host routes on the lb-mgmt-net subnet establish the reverse route. This host route uses the ip_address of the port in interfaces_info as the next_hop and the Subnet of the octavia-provider-subnet as the Destination to be routed to.
To view the host routes for the lb-mgmt-subnet, run the command, oc rsh openstackclient openstack subnet show lb-mgmt-subnet -c host_routes -f yaml:
host_routes:
- destination: 172.23.0.0/24
nexthop: 172.24.1.89
The port used to connect lb-mgmt-subnet to the router is named lb-mgmt-router-port and you can view the details by running the command, oc rsh openstackclient openstack port show lb-mgmt-router-port -f yaml. Note that the port_id in the router’s interface_info can be used instead of the port name.
admin_state_up: true
allowed_address_pairs: []
binding_host_id: ''
binding_profile: {}
binding_vif_details: {}
binding_vif_type: unbound
binding_vnic_type: normal
created_at: '2024-06-11T17:20:41Z'
data_plane_status: null
description: ''
device_id: 371d800c-c803-4210-836b-eb468654462a
device_owner: network:router_interface
device_profile: null
dns_assignment:
- fqdn: host-172-24-1-89.openstackgate.local.
hostname: host-172-24-1-89
ip_address: 172.24.1.89
dns_domain: ''
dns_name: ''
extra_dhcp_opts: []
fixed_ips:
- ip_address: 172.24.1.89
subnet_id: e4ab96af-8077-4971-baa4-e0d40a16f55a
id: 1a44e94d-f44a-4752-81db-bc5402857a08
ip_allocation: immediate
mac_address: fa:16:3e:ba:be:ee
name: lb-mgmt-router-port
network_id: 77881d3f-04b0-46cb-931f-d54003cce9f0
numa_affinity_policy: null
port_security_enabled: true
project_id: dc65b54e9cba475ba0adba7f898060f2
propagate_uplink_status: null
qos_network_policy_id: null
qos_policy_id: null
resource_request: null
revision_number: 3
security_group_ids:
- 055686ce-fb2d-409b-ab74-85df9ab3a9e0
- 5c41444b-0863-4609-9335-d5a66bdbcad8
status: ACTIVE
tags: []
trunk_details: null
updated_at: '2024-06-11T17:21:03Z'
Notice the following about these fields and their values:
-
fixed_ips- matches the IP address for theinterfaces_infoof theoctavia-link-router. -
device_id- matches the ID for theoctavia-link-router. -
device_owner- indicates that OpenStack is using the port as a router interface.
6.2. Load-balancing service instance monitoring Copy linkLink copied to clipboard!
In RHOSO environments, the Load-balancing service (octavia) monitors the load-balancing instances (amphorae) and initiates failovers and replacements if the amphorae malfunction.
Any time a failover occurs, the Load-balancing service logs the failover in the corresponding health manager log on the controller in /var/log/containers/octavia.
Use log analytics to monitor failover trends to address problems early. Problems such as Networking service (neutron) connectivity issues, denial of service attacks, and Compute service (nova) malfunctions often lead to higher failover rates for load balancers.
6.3. Load-balancing service pool member monitoring Copy linkLink copied to clipboard!
In Red Hat OpenStack Services on OpenShift (RHOSO) environments, the Load-balancing service (octavia) uses the health information from the underlying load balancing subsystems to determine the health of members of the load-balancing pool.
Health information is streamed to the Load-balancing service database, and made available by the status tree or other API methods. For critical applications, you must poll for health information in regular intervals.
6.4. Load-balancer provisioning status monitoring Copy linkLink copied to clipboard!
In Red Hat OpenStack Services on OpenShift (RHOSO) environments, you can monitor the provisioning status of a load balancer and send alerts if the provisioning status is ERROR. Do not configure an alert to trigger when an application is making regular changes to the pool and enters several PENDING stages.
The provisioning status of load-balancer objects reflect the ability of the control plane to contact and successfully provision a create, update, and delete request. The operating status of a load-balancer object reports on the current functionality of the load balancer.
For example, a load balancer might have a provisioning status of ERROR, but an operating status of ONLINE. This might be caused by a Networking service (neutron) failure that blocked that last requested update to the load-balancer configuration from successfully completing. In this case, the load balancer continues to process traffic through the load balancer, but might not have applied the latest configuration updates yet.
6.5. Load-balancer functionality monitoring Copy linkLink copied to clipboard!
You can monitor the operational status of your load balancer and its child objects in your Red Hat OpenStack Services on OpenShift (RHOSO) environment.
You can also use an external monitoring service that connects to your load-balancer listeners and monitors them from outside of the cloud. An external monitoring service indicates if there is a failure outside of the Load-balancing service (octavia) that might impact the functionality of your load balancer, such as router failures, network connectivity issues, and so on.
6.6. About Load-balancing service health monitors Copy linkLink copied to clipboard!
A Red Hat OpenStack Services on OpenShift (RHOSO) Load-balancing service (octavia) health monitor is a process that does periodic health checks on each back end member server to pre-emptively detect failed servers and temporarily pull them out of the pool.
If the health monitor detects a failed server, it removes the server from the pool and marks the member in ERROR. After you have corrected the server and it is functional again, the health monitor automatically changes the status of the member from ERROR to ONLINE, and resumes passing traffic to it.
Always use health monitors in production load balancers. If you do not have a health monitor, failed servers are not removed from the pool. This can lead to service disruption for web clients.
There are several types of health monitors, as briefly described here:
- HTTP
-
by default, probes the
/path on the application server. - HTTPS
operates similarly to HTTP health monitors, but with TLS back end servers.
If the servers perform client certificate validation, HAProxy does not have a valid certificate. In these cases, TLS-HELLO health monitoring is an alternative.
- TLS-HELLO
ensures that the back end server responds to SSLv3-client hello messages.
A TLS-HELLO health monitor does not check any other health metrics, such as status code or body contents.
- PING
sends periodic ICMP ping requests to the back end servers.
You must configure back end servers to allow PINGs so that these health checks pass.
ImportantA PING health monitor checks only if the member is reachable and responds to ICMP echo requests. PING health monitors do not detect if the application that runs on an instance is healthy. Use PING health monitors only in cases where an ICMP echo request is a valid health check.
- TCP
opens a TCP connection to the back end server protocol port.
The TCP application opens a TCP connection and, after the TCP handshake, closes the connection without sending any data.
- UDP-CONNECT
performs a basic UDP port connect.
A UDP-CONNECT health monitor might not work correctly if Destination Unreachable (ICMP type 3) is not enabled on the member server, or if it is blocked by a security rule. In these cases, a member server might be marked as having an operating status of
ONLINEwhen it is actually down.
6.7. Create Load-balancing service health monitors Copy linkLink copied to clipboard!
Use Load-balancing service (octavia) health monitors to avoid service disruptions. The health monitors run periodic health checks on each back end server to pre-emptively detect failed servers and temporarily remove the servers from the pool.
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 is on your workstation.$ dnf list installed python-openstackclient
Procedure
Confirm that the system
OS_CLOUDvariable is set for your cloud:$ echo $OS_CLOUD my_cloudReset the variable if necessary:
$ export OS_CLOUD=my_other_cloudAs an alternative, you can specify the cloud name by adding the
--os-cloud <cloud_name>option each time you run anopenstackcommand.Run the
openstack loadbalancer healthmonitor createcommand, using argument values that are appropriate for your site.All health monitor types require the following configurable arguments:
<pool>- Name or ID of the pool of back-end member servers to be monitored.
--type-
The type of health monitor. One of
HTTP,HTTPS,PING,SCTP,TCP,TLS-HELLO, orUDP-CONNECT. --delay- Number of seconds to wait between health checks.
--timeout-
Number of seconds to wait for any given health check to complete.
timeoutmust always be smaller thandelay. --max-retries- Number of health checks a back-end server must fail before it is considered down. Also, the number of health checks that a failed back-end server must pass to be considered up again.
In addition, HTTP health monitor types also require the following arguments, which are set by default:
--url-path-
Path part of the URL that should be retrieved from the back-end server. By default this is
/. --http-method-
HTTP method that is used to retrieve the
url_path. By default this isGET. --expected-codes-
List of HTTP status codes that indicate an OK health check. By default this is
200. - Example
$ openstack loadbalancer healthmonitor create --name my-health-monitor --delay 10 --max-retries 4 --timeout 5 --type TCP lb-pool-1 --wait
Verification
-
Run the
openstack loadbalancer healthmonitor listcommand and verify that your health monitor is running.
6.8. Modifying Load-balancing service health monitors Copy linkLink copied to clipboard!
You can modify the configuration for Red Hat OpenStack Services on OpenShift (RHOSO) Load-balancing service (octavia) health monitors when you want to change the interval for sending probes to members, the connection timeout interval, the HTTP method for requests, and so on.
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 is on your workstation.$ dnf list installed python-openstackclient
Procedure
Confirm that the system
OS_CLOUDvariable is set for your cloud:$ echo $OS_CLOUD my_cloudReset the variable if necessary:
$ export OS_CLOUD=my_other_cloudAs an alternative, you can specify the cloud name by adding the
--os-cloud <cloud_name>option each time you run anopenstackcommand.Modify your health monitor (
my-health-monitor).In this example, a user is changing the time in seconds that the health monitor waits between sending probes to members.
- Example
$ openstack loadbalancer healthmonitor set my_health_monitor --delay 600
Verification
Run the
openstack loadbalancer healthmonitor showcommand to confirm your configuration changes.$ openstack loadbalancer healthmonitor show my_health_monitor
6.9. Deleting Load-balancing service health monitors Copy linkLink copied to clipboard!
You can remove a Red Hat OpenStack Services on OpenShift (RHOSO) Load-balancing service (octavia) health monitor.
An alternative to deleting a health monitor is to disable it by using the openstack loadbalancer healthmonitor set --disable command.
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 is on your workstation.$ dnf list installed python-openstackclient
Procedure
Confirm that the system
OS_CLOUDvariable is set for your cloud:$ echo $OS_CLOUD my_cloudReset the variable if necessary:
$ export OS_CLOUD=my_other_cloudAs an alternative, you can specify the cloud name by adding the
--os-cloud <cloud_name>option each time you run anopenstackcommand.Delete the health monitor (
my-health-monitor).- Example
$ openstack loadbalancer healthmonitor delete my-health-monitor
Verification
-
Run the
openstack loadbalancer healthmonitor listcommand to verify that the health monitor you deleted no longer exists.
6.10. Best practices for Load-balancing service HTTP health monitors Copy linkLink copied to clipboard!
In RHOSO environments, when you write the code that generates the health check in your web application, you must consider situations that can cause cause your checks to fail.
Follow these guidelines when developing your health checks:
-
The health monitor
url-pathdoes not require authentication to load. -
By default, the health monitor
url-pathreturns anHTTP 200 OKstatus code to indicate a healthy server unless you specify alternateexpected-codes. The health check does enough internal checks to ensure that the application is healthy and no more. Ensure that the following conditions are met for the application:
- Any required database or other external storage connections are up and running.
- The load is acceptable for the server on which the application runs.
- Your site is not in maintenance mode.
- Tests specific to your application are operational.
The page generated by the health check should be small in size:
- It returns in a sub-second interval.
- It does not induce significant load on the application server.
The page generated by the health check is never cached, although the code that runs the health check might reference cached data.
For example, you might find it useful to run a more extensive health check by using
cronand store the results to disk. The code that generates the page at the health monitorurl-pathincorporates the results of thiscronjob in the tests it performs.-
Because the Load-balancing service only processes the HTTP status code returned, and because health checks are run so frequently, you can use the
HEADorOPTIONSHTTP methods to skip processing the entire page.