How to Deploy RabbitMQ on Kubernetes?

Photo of author

By admin

RabbitMQ is a stable message exchange program for microservices. In short, RabbitMQ is a message broker program. It allows Kubernetes applications and services to interact with each other so that data transferring becomes easier. However, Apache Kafka, Amazon MQ, Apache Active MQ, Oracle Message Broker, and RabbitMQ work as the message broker software for Kubernetes. But RabbitMQ has been used by developers for years because it is a lightweight message broker that can be easily deployed in cloud-based platforms. Here in this blog post, we will guide you on how to deploy RabbitMQ on Kubernetes. But first, let’s learn about the salient features of this message broker application.

The most highlighted features of RabbitMQ are:

  • RabbitMQ supports different messaging protocols including AMQP, MQTT, STOMP, and more.
  • RabbitMQ is a Distributed Development platform that supports high availability and throughput.
  • The platform supports different plugins and tools.
  • Its user interface is easy to understand.
  • It offers an HTTP-API that helps you manage and monitor Kubernetes applications.
  • It supports popular languages like Java, Python, Ruby, Go, etc.

So, now that you know all the benefits of deploying RabbitMQ, we should easily get going with the procedure of its deployment on Kubernetes.

Prerequisites for Deploying RabbitMQ on Kubernetes

These are the main requirements that you should consider if you wish to deploy RabbitMQ on your Kubernetes:

  • You need a Kubernetes cluster that could be based on anything including AKS, EKS, GKE, Kind, On-Prem.
  • The Kubernetes cluster should have Helm 3 installed.
  • The kubectl CLI tool in Kubernetes.
  • And the terminal window/ command line for typing commands.

Once these prerequisites are acquired, you can go ahead and learn how to deploy the RabbitMQ operator on Kubernetes. Please note that deploying RabbitMQ involves connecting different things. It involves the following pieces:

  • Kubernetes namespace
  • RabbitMQ cluster nodes stateful set
  • Storage capacity of node data directories
  • You will have to create a Kubernetes Secret for Initial RabbitMQ user credentials and r inter-node and CLI tool authentication
  • One headless service for ensuring private communication between different nodes
  • Configuration files of Node and you will have to get their access permissions
  • A pre-enabled plugin file
  • Peer discovery settings
  • And more on the way.

So before you jump into the installation process of RabbitMQ, make sure you have enough time in your hand to perform each of the steps properly.

Step 1. Install the Helm Package Manager

RabbitMQ is complex software for Kubernetes. In fact, most of the Kubernetes solutions are somewhat complex. And the advanced Kubernetes application management process requires the developers to edit some configuration files in the Kubernetes interface. Such a file is Helm package manager which is a Kubernetes application package manager. It organizes the installation process of RabbitMQ and can easily and properly deploy its data in the Kubernetes cluster. Hence, if you want to deploy RabbitMQ on Kubernetes, you will have to install the Helm package manager first.

You can use these commands on your Kubernetes cluster to install the latest version of Helm:

curl -fsSL -o

chmod 700


Use the commands one after another on the terminal and the installation of Helm will be completed. After the installation is done, the helm init command will start the Helm package manager. Now Helm will help you to deploy RabbitMQ on Kubernetes with the help of some other commands. Once you install the Helm package manager, the next step should be to create a Kubernetes namespace and permissions.

Step 2. Create a Kubernetes Namespace

You need to create a Kubernetes namespace because everything in the Kubernetes environment is operated in the namespace. And since RabbitMQ is now a part of it, it will require creating a namespace. We recommended you create a unique namespace that will allow you to set the RabbitMQ cluster apart from other Kubernetes services. And a specific namespace will help you get the permissions to the cluster nodes. If you don’t specify a namespace for RabbitMQ, your system will use a default namespace to manage the data of RabbitMQ. But to easily and quickly create a namespace, use this command:

kubectl create namespace rabbit

After you run this command, your computer will notify you when you have created a namespace successfully. Next, create a StatefulSet that will help you run the RabbitMQ cluster on Kubernetes. The StatefulSet is a process that ensures the positions of the cluster nodes that should be running in order and one at a time. You can go to the gke directory where you will find the StatefulSet definition file. The file contains configuration data of mounting, credentials, opening ports, etc. The file will help identify the network identifiers and find stable storage for the RabbitMQ resources. It also helps with managing updates.

Once done, move on to the next step.

Step 3. Install the RabbitMQ Operator

After clearing the previous steps properly, you can now install the RabbitMQ operator on your Kubernetes. You will have to find a default stable/rabbitmq chart from Github and apply that to your Kubernetes cluster. Run this command to do so:

helm install mu-rabbit stable/rabbitmq –namespace rabbit

You will have to verify if the GitHub repository chat components are healthy to run on your system. The previous command will deploy the RabbitMQ on the Kubernetes namespace we have created beforehand. But following, you will find the detailed information of the RabbitMQ operator. To check if the rabbitmq-system namespace contains the healthy components, match your rabbitmq-cluster-operator with the following information:


kind: RabbitmqCluster


name: production-rabbitmqcluster


replicas: 3



cpu: 500m

memory: 1Gi


cpu: 1

memory: 2Gi


additionalConfig: |

log.console.level = info

channel_max = 1700

default_user= guest

default_pass = guest

default_user_tags.administrator = true


type: LoadBalancer

This is a rabbitmqcluster.yaml manifest file that is available in the Git repo and helps you create the RabbitmqCluster on Kubernetes. Let’s take a glance at the descriptions of these components in the YAML file.

kind: kind refers to the RabbitmqCluster CRD that the RabbitMQ cluster Operator has installed on Kubernetes. It refers to the name of the RabbitmqCluster.

Spec.replicas: This one represents the number of RabbitMQ replicas that we need to create a RabbitMQ Cluster.

resources.requests / resources.limits: The resources requests or limits have been specified in this file. It refers to the number of resource requests your server can make while deploying the Rabbit operator.

rabbitmq.additionalConfig: This one contains the configuration data of the rabbitmq clusters.

Service.type: This is a Kubernetes service type that exposes the RabbitMQ cluster. The RabbitMQ cluster’s service type in our case is LoadBalancer.

Once you deploy the rabbit with helm install mu-rabbit stable/rabbitmq –namespace rabbit command, it’s time to check out the status of the operator. Use the following command to do so:

$ kubectl describe RabbitmqCluster production-rabbitmqcluster

In the terminal that appears, you will find the status of the RabbitMQ cluster and it will give you the user credentials, port number, and the URL to visit the RabbitMQ management dashboard from your Internet browser.

In this case, you will find the username and password of the RabbitMQ cluster interface from a Kubernetes secret that has been created in the process. Here are the username and password to access the RabbitMQ interface:

Username: $ kubectl get secret production-rabbitmqcluster-default-user -o jsonpath='{.data.username}’ | base64 –decode


$ kubectl get secret production-rabbitmqcluster-default-user -o jsonpath='{.data.password}’ | base64 –decode

After initiating the deployment process of RabbitMQ, check out the following section.

Step 4. Check the Provisioning Status of RabbitMQ

You will find the complete status of the RabbitMQ provisioning sequence that will confirm the deployment. To check the status, you can run this command on terminal:

watch kubectl get deployments,pods,services –namespace rabbit

The terminal window will show the details of your RabbitMQ namespace. To check out the resources that your RabbitMQ has created, run the following command:

$ kubectl get all -l

In the terminal, you will find a StatefulSet where the headless service and the Kubernetes LoadBalancer have been specified. The headless server discovers the Kubernetes cluster nodes and the LoadBalancer enables you to access the user interface of RabbitMQ from your browser.

Go check out Step 3 again and read the section where we have mentioned the RabbitMQ cluster interface. You can configure the RabbitMQ Server from that interface only. The RabbitMQ configuration files contain the server settings and plugins of RabbitMQ and if you make changes to those files, you can configure the RabbitMQ server easily. You simply need to open your text editor and open the rabbitmq.conf file that you can edit.

The default configuration file of RabbitMQ is written in sysctl format but before you edit and configure the file, there are some things you should keep in mind:

  • Your system won’t generally execute lines if the sentences start with the # (hash) symbol because that symbol is used to refer to comments.
  • You are allowed to define one set in one line only in the config file.
  • The lines are defined in the Key = Value format

You can define ports, memory storage, permissions, etc. in the rabbitmq.conf file and this information is important to connect Kubernetes applications to the messaging broker. You can see a manageable example of a rabbitmq.conf file in the RabbitMQ server source repository that has a detailed definition of how the configuration file should look like. You can only use that file as a reference but you cannot adapt it to mirror your specific system requirements.

Step 5. Set up the RabbitMQ Management Plugin

You can find the RabbitMQ management plugin in the default RabbitMQ configuration files. But you can enable the plugin using a simple command. Use the <strong>rabbitmq-plugins</strong> command:

rabbitmq-plugins enable rabbitmq_management

Check out Step 3 again and find out the IP and port number of the RabbitMQ server. You can use that user credentials to log in to the Rabbit server only. Here is how you can enter it on your browser to access the web interface:


The IP and port number of RabbitMQ were given to you during the installation process and when you access the web interface from a browser, the server will ask for those credentials. Generally, the RabbitMQ installation pre-defines both the username and password as “guest.”

Now, with the RabbitMQ management plugin, you can access your interface and manage hosts, permissions, messages queues, exchanges, etc. Even though you can do all this stuff effortlessly, you need to know how the RabbitMQ on Kubernetes works.

The main purpose of Kubernetes is to automate tasks and operate services for a Kubernetes cluster. With RabbitMQ though, you can improve the way Kubernetes works. RabbitMQ enhances the task management process and stabilizes the background resources. With the Advanced Message Queuing Protocol (AMQP), RabbitMQ can easily transfer messages between brokers and consumers as soon as they are produced by the producer.

A producer is a performer that will produce the message to the RabbitMQ platform and the messages will be lined up in a queue. And then the consumers will receive those messages. The message exchange improves the communication between Kubernetes applications and services.


So, let’s wrap up the whole article in a single paragraph so that you remember all that we have discussed here. You need the RabbitMQ message broker program to simplify the message transferring process between Kubernetes applications. Once the producer releases a message, the broker will transfer the texts to the consumers aka the Kubernetes application. You can easily install or deploy RabbitMQ on your Kubernetes using some simple commands. But the first step you should take is to establish the Helm package manager. Once you install RabbitMQ with Helm, the services in your Kubernetes cluster can interact with each other effortlessly and efficiently.

Also, we have shared how to get access to the RabbitMQ management plugin later in this post. From there, you can manage the RabbitMQ web interface and monitor how the messages go in the queue. This does not only reduce the message loads between the web application servers but also the delivery process of those messages. However, if you have any problem with deploying RabbitMQ on Kubernetes, you can ask us in the comment box below. Additionally, feel open to going through our other articles to gain more insight into the subject.

Leave a Comment