Chapter 3. RHOSO RabbitMQ clusters
Red Hat OpenStack Services on OpenShift (RHOSO) deploys the following two RabbitMQ clusters:
-
rabbitmqused for messaging between OpenStack services. -
rabbitmq-cell1used for the Compute service (nova) forcell1.
RabbitMQ Custom Resources configures both clusters.
You can choose to implement an improved failover behavior for a deployed RabbitMQ cluster that bypasses the default availability checks of OpenShift, which can wait up to five minutes to declare a service dead. The configuration of this improved RabbitMQ failover behavior is explained in step 6 of Creating the control plane in Deploying Red Hat OpenStack Services on OpenShift. If you implement this change on a deployed RHOSO environment then after applying this change to the control plane you must redeploy the data plane to update all the Compute nodes.
- To retrieve more information about the RabbitMQ clusters, use the following command:
$ oc get rabbitmq --show-labels
NAME ALLREPLICASREADY RECONCILESUCCESS AGE LABELS
rabbitmq True True 25h <none>
rabbitmq-cell1 True True 25h <none>
The infra-operator performs the following tasks:
- Creates the pods that run the rabbitmq servers.
- Monitors the pods that run the rabbitmq servers.
- Restarts the pods that run the rabbitmq servers when health checks fail.
3.1. Understand the RabbitMQ interface for OpenStack services Copy linkLink copied to clipboard!
The RabbitMQ interface for OpenStack services in Red Hat OpenStack Services on OpenShift (RHOSO) has been expanded to improve the isolation and scalability of RabbitMQ communication.
The initial implementation of the RabbitMQ interface for OpenStack services consisted of a single setting in the OpenStackControlPlane CR to specify the RabbitMQ cluster. The RabbitMQ interface has been revised into an expandable structure, which in addition to specifying the RabbitMQ cluster, you can specify a dedicated RabbitMQ user and a dedicated RabbitMQ virtual host for both of the communication methods facilitated by RabbitMQ.
OpenStack services use RabbitMQ for the following two distinct messaging purposes:
-
Remote Procedure Call (RPC) used for synchronous request and response communication between OpenStack services, which is configured using the new
messagingBussection in thetemplateof each service in theOpenStackControlPlaneCR. -
Notifications used for asynchronous event broadcasting, which is configured using the new
notificationsBussection in thetemplateof each service in theOpenStackControlPlaneCR.
In a typical RHOSO deployment, the OpenStack services typically use the same RabbitMQ cluster for both RPC and notifications. Therefore you can set global defaults for the messagingBus and notificationsBus RabbitMQ settings in the OpenStackControlPlane CR to specify the default RabbitMQ cluster:
apiVersion: core.openstack.org/v1beta1
kind: OpenStackControlPlane
metadata:
name: openstack
spec:
messagingBus:
cluster: <rabbitmq-cluster>
notificationsBus:
cluster: <rabbitmq-cluster>
where:
<rabbitmq-cluster>-
Specifies the default RabbitMQ cluster that all the OpenStack services use, for example,
rabbitmq.
By default, RHOSO creates a shared RabbitMQ user for all OpenStack services. For security and isolation, you can create dedicated RabbitMQ users for your OpenStack services. For more information, see the Additional resources section below.
To specify service-specific RabbitMQ clusters or to create dedicated RabbitMQ users, you can add and configure one or both of the following standard RabbitMQ configuration sections to the template of each RHOSO service in the OpenStackControlPlane CR, depending upon the messaging requirements of each service:
...
template:
messagingBus:
cluster: <rabbitmq-rpc-cluster>
user: <rabbitmq-rpc-user>
vhost: <rabbitmq-rpc-vhost-name>
where:
<rabbitmq-rpc-cluster>- Specifies the name of the RabbitMQ cluster for the RPC communication of this service
<rabbitmq-rpc-user>- Specifies the name of the dedicated RabbitMQ user for the RPC communication of this service.
<rabbitmq-rpc-vhost-name>-
Specifies the name of the RabbitMQ virtual host for the RPC communication of this service, which defaults to
/.
...
template:
notificationsBus:
cluster: <rabbitmq-notif-cluster>
user: <rabbitmq-notif-user>
vhost: <rabbitmq-notif-vhost-name>
where:
<rabbitmq-notif-cluster>- Specifies the name of the RabbitMQ cluster for notifications of this service.
<rabbitmq-notif-user>- Specifies the name of the dedicated RabbitMQ user for notifications of this service.
<rabbitmq-notif-vhost-name>-
Specifies the name of the RabbitMQ virtual host for notifications of this service, which defaults to
/.
RHOSO manages the RabbitMQ user passwords of the user names that you specify.
Your deployment might require service specific RabbitMQ clusters in the following scenarios:
When you specify a service specific RabbitMQ cluster this overrides the global default RabbitMQ cluster setting.
- Separate RabbitMQ clusters for Compute service cells
-
The Compute service (nova) cells often use dedicated
messagingBusRabbitMQ clusters for isolation:
...
nova:
...
template:
cellTemplates:
cell0:
...
messagingBus:
cluster: rabbitmq # Cell0 uses default RabbitMQ cluster
cell1:
...
messagingBus:
cluster: rabbitmq-cell1 # Cell1 uses dedicated RabbitMQ cluster
- Dedicated RabbitMQ clusters for high-traffic services
- You can specify a dedicated RabbitMQ cluster to isolate high-traffic services, such as the Networking service (neutron):
You must create this dedicated RabbitMQ cluster separately in the rabbitmq service spec.
neutron:
template:
messagingBus:
cluster: rabbitmq-neutron # Dedicated RabbitMQ cluster for the Networking service
vhost: neutron
- Dedicated RabbitMQ virtual hosts for OpenStack services
-
Multiple OpenStack services use the same RabbitMQ cluster, which is called
rabbitmqby default. The default configuration of this shared RabbitMQ cluster could pose a security risk because if one of these OpenStack services become compromised they could access the RabbitMQ messages from other services. But if you configure a dedicated RabbitMQ virtual host for an OpenStack service, you remove their RabbitMQ messages from the general pool, enabling both the logical grouping and logical separation of their RabbitMQ messages.
The following example configures a dedicated RabbitMQ virtual host for the Block Storage (cinder) OpenStack service:
spec:
messagingBus:
cluster: rabbitmq # Default for most services
...
cinder:
template:
messagingBus:
vhost: cinder-vhost # Block Storage Cinder uses dedicated vhost
3.2. Monitoring the state and service availability of RabbitMQ Copy linkLink copied to clipboard!
You can use the following commands to retrieve information about the state and service availability of the RabbitMQ clusters and their pods:
Each RabbitMQ replica runs in a dedicated pod.
You can use the following command to determine the status of the RabbitMQ pods:
$ oc get pods -l app.kubernetes.io/name=rabbitmq
NAME READY STATUS RESTARTS AGE
rabbitmq-server-0 1/1 Running 0 46h
rabbitmq-server-1 1/1 Running 0 46h
rabbitmq-server-2 1/1 Running 0 46h
The RabbitMQ service Operator rabbitmq-cluster-operator creates the following two OpenStack service objects for a RabbitMQ cluster:
-
The
rabbitmq-nodesservice, which provides a DNS name resolution to the rabbitmq servers for internal RabbitMQ communication. -
The RabbitMQ messaging service that is exposed using an Red Hat OpenShift Container Platform (RHOCP) service managed by MetalLB called
rabbitmq.
You can use the following command to determine the type of these services and their ports:
$ oc get service -l app.kubernetes.io/name=rabbitmq
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
rabbitmq LoadBalancer 172.30.170.63 172.17.0.85 5671:31331/TCP,15671:31404/TCP,15691:31453/TCP 47h
rabbitmq-nodes ClusterIP None <none> 4369/TCP,25672/TCP 47h
The MetalLB-managed service, called rabbitmq, is a LoadBalancer across the RabbitMQ pods. It has an IP address that listens to the internal API network so it is accessible from the Red Hat OpenStack Services on OpenShift (RHOSO) data plane and control plane.
You can use the following command to determine the configuration of the rabbitmq service:
$ oc describe service rabbitmq
Name: rabbitmq
Namespace: openstack
Labels: app.kubernetes.io/component=rabbitmq
app.kubernetes.io/name=rabbitmq
app.kubernetes.io/part-of=rabbitmq
Annotations: dnsmasq.network.openstack.org/hostname: rabbitmq.openstack.svc
metallb.universe.tf/address-pool: internalapi
metallb.universe.tf/ip-allocated-from-pool: internalapi
metallb.universe.tf/loadBalancerIPs: 172.17.0.85
Selector: app.kubernetes.io/name=rabbitmq
Type: LoadBalancer
IP Family Policy: SingleStack
IP Families: IPv4
IP: 172.30.170.63
IPs: 172.30.170.63
LoadBalancer Ingress: 172.17.0.85
Port: amqps 5671/TCP
TargetPort: 5671/TCP
NodePort: amqps 31331/TCP
Endpoints: 192.168.16.69:5671,192.168.20.54:5671,192.168.24.45:5671
In this example, this MetalLB-managed service called rabbitmq, receives incoming traffic from the internal API on 172.17.0.85, which is known as the LoadBalancer Ingress, and forwards it to its IP address of 172.30.170.63 which balances traffic to the RabbitMQ pods.