Deploying Specific Configuration on RabbitMQ in Kubernetes
search cancel

Deploying Specific Configuration on RabbitMQ in Kubernetes

book

Article ID: 403578

calendar_today

Updated On:

Products

VMware Tanzu Data Suite RabbitMQ Support Only for OpenSource RabbitMQ VMware Tanzu RabbitMQ VMware vFabric RabbitMQ 2.x

Issue/Introduction

In Kubernetes-based environments, you may need to configure RabbitMQ with specific settings, or any other custom configurations that align with your operational or security requirements. 

Environment

RabbitMQ Version: 4.1.0

Cause

In Kubernetes, RabbitMQ is typically deployed using the RabbitMQ Cluster Operator, which helps manage RabbitMQ clusters efficiently. The configuration for RabbitMQ needs to be applied through Kubernetes resources (like the RabbitmqCluster CRD), but users may find it unclear how to modify configuration files such as rabbitmq.conf or how to add custom configuration.

 

Resolution

To apply a custom configuration in RabbitMQ deployed on Kubernetes, use the RabbitmqCluster resource and the additionalConfig option. This option allows you to add settings directly into the rabbitmq.conf file.

a) Sample YAML - In the additionalConfig section, you can add any RabbitMQ configuration settings

apiVersion: v1
kind: ConfigMap
metadata:
  name: rabbitmq-config
data:
  rabbitmq.conf: |
    <customer-configuration-to-be-placed-here>

 

b) You can deploy RabbitMQ by referencing the ConfigMap created above

apiVersion: apps/v1
kind: Deployment
metadata:
  name: rabbitmq
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rabbitmq
  template:
    metadata:
      labels:
        app: rabbitmq
    spec:
      containers:
      - name: rabbitmq
        image: rabbitmq:4.1.0
        ports:
        - containerPort: 5672
        - containerPort: 15672
        volumeMounts:
        - name: rabbitmq-config-volume
          mountPath: /etc/rabbitmq
      volumes:
      - name: rabbitmq-config-volume
        configMap:
          name: rabbitmq-config

 

c) Apply the changes

kubectl apply -f rabbitmq-deployment.yaml

d) Verify the same by inspecting the latest logs:

kubectl logs <rabbitmq-pod-name>

 

Additional Information

- Example for customer configuration 

- Additional Configuration details