I deployed a rabbitmq instance using the rabbitmq operator in kubernetes. And I'm trying to enable the rabbitmq plugin: rabbitmq_delayed_message_exchange.

I tried defining my RabbitmqCluster as:

apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
  name: definition
spec:
  replicas: 1
  rabbitmq:
    additionalPlugins:
      - rabbitmq_management
      - rabbitmq_delayed_message_exchange
  service:
    type: LoadBalancer

And then I ran kubectl apply -f definition.yaml

But my pod logs showed this:

...
2020-10-05T15:42:15.081783023Z 2020-10-05 15:42:15.081 [info] <0.535.0> Server startup complete; 6 plugins started.
2020-10-05T15:42:15.081802701Z  * rabbitmq_prometheus
2020-10-05T15:42:15.08180602Z  * rabbitmq_peer_discovery_k8s
2020-10-05T15:42:15.081808816Z  * rabbitmq_peer_discovery_common
2020-10-05T15:42:15.081811359Z  * rabbitmq_management
2020-10-05T15:42:15.08181387Z  * rabbitmq_web_dispatch
2020-10-05T15:42:15.081825082Z  * rabbitmq_management_agent
2020-10-05T15:42:15.081951576Z  completed with 6 plugins.
...

There wasn't any reference to this plugin in the logs.

I went inside my rabbitmq pod and ran: rabbitmq-plugins list

Listing plugins with pattern ".*" ...
 Configured: E = explicitly enabled; e = implicitly enabled
 | Status: * = running on rabbit@definition-rabbitmq-server-0.definition-rabbitmq-headless.default
 |/
[  ] rabbitmq_amqp1_0                  3.8.8
[  ] rabbitmq_auth_backend_cache       3.8.8
[  ] rabbitmq_auth_backend_http        3.8.8
[  ] rabbitmq_auth_backend_ldap        3.8.8
[  ] rabbitmq_auth_backend_oauth2      3.8.8
[  ] rabbitmq_auth_mechanism_ssl       3.8.8
[  ] rabbitmq_consistent_hash_exchange 3.8.8
[  ] rabbitmq_event_exchange           3.8.8
[  ] rabbitmq_federation               3.8.8
[  ] rabbitmq_federation_management    3.8.8
[  ] rabbitmq_jms_topic_exchange       3.8.8
[E*] rabbitmq_management               3.8.8
[e*] rabbitmq_management_agent         3.8.8
[  ] rabbitmq_mqtt                     3.8.8
[  ] rabbitmq_peer_discovery_aws       3.8.8
[e*] rabbitmq_peer_discovery_common    3.8.8
[  ] rabbitmq_peer_discovery_consul    3.8.8
[  ] rabbitmq_peer_discovery_etcd      3.8.8
[E*] rabbitmq_peer_discovery_k8s       3.8.8
[E*] rabbitmq_prometheus               3.8.8
[  ] rabbitmq_random_exchange          3.8.8
[  ] rabbitmq_recent_history_exchange  3.8.8
[  ] rabbitmq_sharding                 3.8.8
[  ] rabbitmq_shovel                   3.8.8
[  ] rabbitmq_shovel_management        3.8.8
[  ] rabbitmq_stomp                    3.8.8
[  ] rabbitmq_top                      3.8.8
[  ] rabbitmq_tracing                  3.8.8
[  ] rabbitmq_trust_store              3.8.8
[e*] rabbitmq_web_dispatch             3.8.8
[  ] rabbitmq_web_mqtt                 3.8.8
[  ] rabbitmq_web_mqtt_examples        3.8.8
[  ] rabbitmq_web_stomp                3.8.8
[  ] rabbitmq_web_stomp_examples       3.8.8

and checked the pod plugins/ directory:

README
accept-0.3.5.ez
amqp10_client-3.8.8.ez
amqp10_common-3.8.8.ez
amqp_client-3.8.8.ez
aten-0.5.5.ez
base64url-0.0.1.ez
cowboy-2.6.1.ez
cowlib-2.7.0.ez
credentials_obfuscation-2.2.0.ez
cuttlefish-2.4.1.ez
eetcd-0.3.3.ez
gen_batch_server-0.8.4.ez
getopt-1.0.1.ez
goldrush-0.1.9.ez
gun-1.3.3.ez
jose-1.10.1.ez
jsx-2.11.0.ez
lager-3.8.0.ez
observer_cli-1.5.4.ez
prometheus-4.6.0.ez
ra-1.1.6.ez
rabbit-3.8.8.ez
rabbit_common-3.8.8.ez
rabbitmq_amqp1_0-3.8.8.ez
rabbitmq_auth_backend_cache-3.8.8.ez
rabbitmq_auth_backend_http-3.8.8.ez
rabbitmq_auth_backend_ldap-3.8.8.ez
rabbitmq_auth_backend_oauth2-3.8.8.ez
rabbitmq_auth_mechanism_ssl-3.8.8.ez
rabbitmq_aws-3.8.8.ez
rabbitmq_consistent_hash_exchange-3.8.8.ez
rabbitmq_event_exchange-3.8.8.ez
rabbitmq_federation-3.8.8.ez
rabbitmq_federation_management-3.8.8.ez
rabbitmq_jms_topic_exchange-3.8.8.ez
rabbitmq_management-3.8.8.ez
rabbitmq_management_agent-3.8.8.ez
rabbitmq_mqtt-3.8.8.ez
rabbitmq_peer_discovery_aws-3.8.8.ez
rabbitmq_peer_discovery_common-3.8.8.ez
rabbitmq_peer_discovery_consul-3.8.8.ez
rabbitmq_peer_discovery_etcd-3.8.8.ez
rabbitmq_peer_discovery_k8s-3.8.8.ez
rabbitmq_prelaunch-3.8.8.ez
rabbitmq_prometheus-3.8.8.ez
rabbitmq_random_exchange-3.8.8.ez
rabbitmq_recent_history_exchange-3.8.8.ez
rabbitmq_sharding-3.8.8.ez
rabbitmq_shovel-3.8.8.ez
rabbitmq_shovel_management-3.8.8.ez
rabbitmq_stomp-3.8.8.ez
rabbitmq_top-3.8.8.ez
rabbitmq_tracing-3.8.8.ez
rabbitmq_trust_store-3.8.8.ez
rabbitmq_web_dispatch-3.8.8.ez
rabbitmq_web_mqtt-3.8.8.ez
rabbitmq_web_mqtt_examples-3.8.8.ez
rabbitmq_web_stomp-3.8.8.ez
rabbitmq_web_stomp_examples-3.8.8.ez
ranch-1.7.1.ez
recon-2.5.1.ez
stdout_formatter-0.2.4.ez
syslog-3.4.5.ez
sysmon_handler-1.3.0.ez

So it means that the plugin doesn't come integrated.

I also found this:

How to install rabbitmq plugin on kubernetes?

But there is no reference to the rabbitmq operator and it was asked in Jun 2018. Also in the rabbitmq operator config there isn't any reference on using lifecycle hooks to mount the ez file.

1 idea that comes to my mind is creating my own rabbitmq image referencing the rabbitmq official image and add the plugin.

FROM rabbitmq:3.8.8-management

RUN apt-get update

RUN apt-get install -y curl

RUN curl -L https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/v3.8.0/rabbitmq_delayed_message_exchange-3.8.0.ez > $RABBITMQ_HOME/plugins/rabbitmq_delayed_message_exchange-3.8.0.ez

RUN chown rabbitmq:rabbitmq $RABBITMQ_HOME/plugins/rabbitmq_delayed_message_exchange-3.8.0.ez

RUN rabbitmq-plugins enable --offline rabbitmq_delayed_message_exchange

RUN rabbitmq-plugins enable --offline rabbitmq_consistent_hash_exchange

A 2nd idea is to mount the file in the pod file directory by defining a configmap with the file and using volumeMounts but I couldn't find any reference to use volumeMounts with the rabbitmq operator.

Is there a preferred way or any other way to enable it?

1

There are 1 answers

0
Arturo Aviles On

This plugin can be enabled by using a custom Docker Rabbitmq image with the plugin installed:

FROM rabbitmq:3.8.8-management

RUN apt-get update

RUN apt-get install -y curl

RUN curl -L https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/v3.8.0/rabbitmq_delayed_message_exchange-3.8.0.ez > $RABBITMQ_HOME/plugins/rabbitmq_delayed_message_exchange-3.8.0.ez

RUN chown rabbitmq:rabbitmq $RABBITMQ_HOME/plugins/rabbitmq_delayed_message_exchange-3.8.0.ez

RUN rabbitmq-plugins enable --offline rabbitmq_delayed_message_exchange

RUN rabbitmq-plugins enable --offline rabbitmq_consistent_hash_exchange

Notice: For immutable results or in case you can't depend on external changes, download the plugin to your machine and use COPY instead of using RUN curl... Make sure to have the rabbitmq_delayed_message_exchange .ez file in your machine.

  • Push your image to a container registry.

And then define your RabbitmqCluster as:

apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
  name: definition
spec:
  image: <container-registry>/<username>/rabbitmq-delayed-message-exchange:3.8.8-management
  replicas: 1
  rabbitmq:
    additionalPlugins:
      - rabbitmq_management
      - rabbitmq_delayed_message_exchange
  service:
    type: LoadBalancer

Notice: Change the image to the one you pushed.