Running rabbitmq with oauth2 in kubernetes cluster

9/3/2021

I am quite new to Kubernetes, I want to set up RabbitMQ with oauth2 in Kubernetes. I am able to set up in docker-compose where I can mount oouath2 conf file to etc/rabbitmq/rabbitmq.config and also enabled plugins everything seems to work. Now I am trying to set it up in Kubernetes I followed the example from RabbitMQ on Kubernetes but for some reason, I get the following error

error: Docker configuration environment variables specified, but old-style (Erlang syntax) configuration file '/etc/rabbitmq/rabbitmq.config' exists
  Suggested fixes: (choose one)
   - remove '/etc/rabbitmq/rabbitmq.config'
   - remove any Docker-specific 'RABBITMQ_...' environment variables
   - convert '/etc/rabbitmq/rabbitmq.config' to the newer sysctl format ('/etc/rabbitmq/rabbitmq.conf'); see https://www.rabbitmq.com/configure.html#config-file

I have a conf file in the following format

[
  %% ...
  %% backend configuration
  {rabbitmq_auth_backend_oauth2, [
    {resource_server_id, <<"my_rabbit_server">>},
    %% UAA signing key configuration
    {key_config, [
      {signing_keys, #{
        <<"a-key-ID">> => {pem, <<"-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2dP+vRn+Kj+S/oGd49kq
6+CKNAduCC1raLfTH7B3qjmZYm45yDl+XmgK9CNmHXkho9qvmhdksdzDVsdeDlhK
IdcIWadhqDzdtn1hj/22iUwrhH0bd475hlKcsiZ+oy/sdgGgAzvmmTQmdMqEXqV2
B9q9KFBmo4Ahh/6+d4wM1rH9kxl0RvMAKLe+daoIHIjok8hCO4cKQQEw/ErBe4SF
2cr3wQwCfF1qVu4eAVNVfxfy/uEvG3Q7x005P3TcK+QcYgJxav3lictSi5dyWLgG
QAvkknWitpRK8KVLypEj5WKej6CF8nq30utn15FQg0JkHoqzwiCqqeen8GIPteI7
VwIDAQAB
-----END PUBLIC KEY-----">>}
          }}
      ]}
    ]}
].

As far as I can understand from the error I need to change my config file format to something like this:

default_user = admin
default_pass = admin
auth_backends.1 = rabbit_auth_backend_oauth2, rabbit_auth_backend_internal

mqtt.default_user = mqtt
mqtt.default_pass = mqtt
mqtt.allow_anonymous = true
mqtt.vhost = /
mqtt.exchange = amq.topic
mqtt.subscription_ttl = 1800000
mqtt.prefetch = 10
mqtt.listeners.tcp = 1883
mqtt.listeners.ssl =
mqtt.tcp_listen_options.packet = raw
mqtt.tcp_listen_options.reuseaddr = true
mqtt.tcp_listen_options.backlog = 128
mqtt.tcp_listen_options.nodelay = true

But I can't seem to find the syntax for the oauth2 config in that format. I can't even find an example of RabbitMQ with an oauth2 setup running on Kubernetes.

-- poojagowda
kubernetes
oauth-2.0
rabbitmq

0 Answers