How to enable plugins on RabbitMQ in Kubernetes
search cancel

How to enable plugins on RabbitMQ in Kubernetes

book

Article ID: 293208

calendar_today

Updated On:

Products

VMware RabbitMQ

Issue/Introduction

When you install RabbitMQ for Kubernetes, the following plugins are enabled by default:
 
  • rabbitmq_peer_discovery_k8s
  • rabbitmq_management
  • rabbitmq_prometheus
This KB article will discuss how you can enable other pliugins.

Environment

Product Version: 1.0

Resolution

Below are steps on how you can enable plugins and how to add additional plugin configurations. In these examples, we will be trying to enable the rabbitmq_trust_store plugin.
​​​​​​
If you are using the RabbitMQ Cluster Kubernetes Operator:

Use additionalPlugins to specify any additional plugins that you want to enable and use additionalConfig to add your plugin configurations. See the example below:
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
  name: tanzu-rabbitmq-test
  namespace: rabbitmq-test
spec:
  # https://network.pivotal.io/products/rabbitmq
  image: registry.pivotal.io/rabbitmq/vmware-tanzu-rabbitmq:2020.12
  imagePullSecrets:
    - name: vmware-tanzu-registry
  replicas: 1
  resources:
    requests:
      cpu: 1
      memory: 1Gi
    limits:
      cpu: 1
      memory: 1Gi
  rabbitmq:
    # Put additional plugins here you want to enable
    additionalPlugins:
      - rabbitmq_trust_store
   # Put additional plugin configuration here
    additionalConfig: |
      cluster_partition_handling = ignore
      vm_memory_high_watermark_paging_ratio = 0.99
      disk_free_limit.relative = 1.0
      trust_store.providers.1 = http
      trust_store.url = https://example.cert.url/path
      trust_store.refresh_interval = 30
  persistence:
    storageClassName: thin-disk
    storage: "20Gi"
  override:
    statefulSet:
      spec:
        template:
          spec:
            containers:
              - name: rabbitmq
                imagePullPolicy: Always
            topologySpreadConstraints:
              - maxSkew: 1
                topologyKey: "topology.kubernetes.io/zone"
                whenUnsatisfiable: DoNotSchedule
                labelSelector:
                  matchLabels:
                    app.kubernetes.io/component: rabbitmq

If you are not using the RabbitMQ Cluster Kubernetes Operator, create a configMap and reference the configMap in your RabbitMQ deployment:
apiVersion: v1
kind: ConfigMap
metadata:
  name: rabbitmq-config
  namespace: rabbitmq-test
data:
  # append additional plugin to list here
  enabled_plugins: |
    [rabbitmq_peer_discovery_k8s, rabbitmq_management, rabbitmq_prometheus, rabbitmq_trust_store].
  # append additional plugin config here
  rabbitmq.conf: |
    cluster_formation.peer_discovery_backend = k8s
    cluster_formation.k8s.host = kubernetes.default.svc.cluster.local
    cluster_formation.k8s.address_type = hostname
    cluster_formation.k8s.service_name = rabbitmq-headless
    queue_master_locator=min-masters
    trust_store.providers.1 = http 
    trust_store.url = https://example.cert.url/path 
    trust_store.refresh_interval = 30

To verify if the plugin is enabled, run the rabbitmq-plugins list on one of RabbitMQ node pods:
# kubectl exec --stdin --tty tanzu-rabbitmq-test-server-0  -- /bin/sh
$ rabbitmq-plugins list
Listing plugins with pattern ".*" ...
 Configured: E = explicitly enabled; e = implicitly enabled
 | Status: * = running on rabbit@tanzu-rabbitmq-get-started-server-0.tanzu-rabbitmq-get-started-nodes.default
 |/
[  ] rabbitmq_amqp1_0                           3.8.9
[  ] rabbitmq_auth_backend_cache                3.8.9
[  ] rabbitmq_auth_backend_http                 3.8.9
[  ] rabbitmq_auth_backend_ldap                 3.8.9
[  ] rabbitmq_auth_backend_oauth2               3.8.9
[  ] rabbitmq_auth_mechanism_ssl                3.8.9
[  ] rabbitmq_consistent_hash_exchange          3.8.9
[  ] rabbitmq_event_exchange                    3.8.9
[  ] rabbitmq_federation                        3.8.9
[  ] rabbitmq_federation_management             3.8.9
[  ] rabbitmq_jms_topic_exchange                3.8.9
[E*] rabbitmq_management                        3.8.9
[e*] rabbitmq_management_agent                  3.8.9
[  ] rabbitmq_mqtt                              3.8.9
[  ] rabbitmq_peer_discovery_aws                3.8.9
[e*] rabbitmq_peer_discovery_common             3.8.9
[  ] rabbitmq_peer_discovery_consul             3.8.9
[  ] rabbitmq_peer_discovery_etcd               3.8.9
[E*] rabbitmq_peer_discovery_k8s                3.8.9
[E*] rabbitmq_prometheus                        3.8.9
[  ] rabbitmq_random_exchange                   3.8.9
[  ] rabbitmq_recent_history_exchange           3.8.9
[  ] rabbitmq_schema_definition_sync            1.0.6
[  ] rabbitmq_schema_definition_sync_prometheus 1.0.5
[  ] rabbitmq_sharding                          3.8.9
[  ] rabbitmq_shovel                            3.8.9
[  ] rabbitmq_shovel_management                 3.8.9
[  ] rabbitmq_stomp                             3.8.9
[  ] rabbitmq_top                               3.8.9
[  ] rabbitmq_tracing                           3.8.9
[E*] rabbitmq_trust_store                       3.8.9