Guide · RabbitMQ

The RabbitMQ on Kubernetes Guide

RabbitMQ runs well on Kubernetes when the platform is treated as what it is: a scheduler that will move, restart and re-network your brokers without asking. This guide takes the decisions in order and points to the article that owns each one.

Tyler Eastridge

By Tyler Eastridge, Head of Operations

LinkedIn · Updated

4 min read8 sections
On this page
Kubernetes in one paragraph

Kubernetes in one paragraph

Use the RabbitMQ Cluster Operator rather than a hand-written StatefulSet. Give every node a persistent volume from a storage class whose failure domain you have checked, resource requests that match peak rather than average, and a pod anti-affinity rule that keeps nodes on separate hosts and zones. Allow the Erlang distribution and EPMD ports in network policy, tune heartbeats to the cluster network, monitor with the Prometheus plugin and the Operator's metrics, and roll updates one node at a time so quorum is never lost. Where none of that is something your team wants to own, a managed service on your cluster is the alternative to leaving Kubernetes.

Decide whether Kubernetes is the right home

Kubernetes gives RabbitMQ scheduling, self-healing and a consistent deployment model, and takes away control over placement, networking and restarts unless you claim it back with configuration. It fits estates already operating Kubernetes with persistent workloads. It does not fit a team running Kubernetes for stateless services only, who will meet stateful failure modes for the first time on the message broker.

Use the Cluster Operator

The RabbitMQ Cluster Operator manages the StatefulSet, the headless service, the Erlang cookie, plugin enablement and rolling updates from a single RabbitmqCluster resource, and the Messaging Topology Operator manages vhosts, users, queues and policies as Kubernetes objects. A hand-written StatefulSet can work, and every one we have inherited has had a rolling-update or peer-discovery defect the Operator already handles. On OpenShift the Operator is the supported path and the security-context constraints need setting explicitly.

Persistent volumes and the storage class's failure domain

Every node needs its own persistent volume, and the storage class decides what a failure looks like: zonal disks pin the pod to a zone and are lost with it, regional disks survive a zone and cost more, and network file systems are too slow for the quorum write-ahead log. Check the failure domain, the IOPS and the reclaim policy before trusting a replica count. Volume snapshots are a backup, not a failover.

Networking: distribution ports, policy and heartbeats

Nodes talk over Erlang distribution and discover each other through EPMD, so network policy must allow those ports between the pods as well as AMQP and the management port from clients. Clients should connect through a Service or a load balancer that understands long-lived connections, not one that idles them out. Cluster networks add jitter that a LAN does not; tune heartbeats and net_ticktime to it, or a busy node will be declared dead by its peers.

Requests, limits and anti-affinity

Requests set to peak memory and CPU, not average, or the scheduler will pack nodes onto hosts that cannot hold them under load. Memory limit above the RabbitMQ watermark with headroom for Erlang, or the kernel kills the node before RabbitMQ can apply flow control. Pod anti-affinity across hosts and topology-spread across zones, so a node failure is a node failure and not a cluster one. PodDisruptionBudget of one, so a cluster upgrade cannot evict two nodes at once.

Monitoring on Kubernetes

The Prometheus plugin exposes per-node and per-object metrics; scrape both, and add the Operator's own metrics and the kubelet's for pod restarts and volume health. Five things matter first: queue depth and unacked counts, memory against the watermark, disk free against the limit, connection and channel counts, and partition status. Alert on trends, and correlate a RabbitMQ alarm with pod events, because on Kubernetes the cause is often a reschedule.

Rolling updates that keep quorum

The Operator rolls one node at a time and waits for it to rejoin, which is the whole point; the failure mode is an image change plus a node-pool upgrade plus an autoscaler decision landing in the same hour. Sequence platform and broker upgrades, respect the PodDisruptionBudget, and check quorum-queue leader distribution before and after. Version upgrades follow the same hop rules as anywhere else, including the Erlang dependency and the feature-flag sequence.

Who operates it

A broker on Kubernetes needs someone who understands both, and that person is often the one who left. The alternatives to abandoning Kubernetes are a support contract, if the platform team can hold the pager, or a managed service that runs the Operator, the volumes, the network policy and the updates on your cluster while the data stays in your account.

Frequently asked questions

Should RabbitMQ run on Kubernetes?

If the team already operates stateful workloads on Kubernetes, yes, with the Cluster Operator, checked storage classes and network policy for Erlang distribution. If Kubernetes is only used for stateless services, the broker will be the first place the stateful failure modes appear, and VMs or a managed service are usually the better home.

Do I need the RabbitMQ Cluster Operator?

Practically, yes. It handles peer discovery, the Erlang cookie, rolling updates one node at a time, and plugin management from one resource, and the Messaging Topology Operator adds vhosts, users and policies as Kubernetes objects. Hand-written StatefulSets work until the first rolling update goes wrong.

Why does my RabbitMQ pod keep restarting on Kubernetes?

Most often a memory limit below what the node needs at peak, so the kernel kills it before RabbitMQ's own watermark engages; second most often a liveness probe with a timeout shorter than a busy node's response. Check the pod events against the RabbitMQ log before changing anything else.

Which is best for RabbitMQ: EKS, AKS or GKE?

All three run it; they differ on storage class behaviour, load balancer handling of long-lived connections, and node-pool upgrade mechanics. The comparison post works through each. The choice is usually made by where the rest of the estate already is.

RabbitMQ services

Where this gets done

More resources

Other RabbitMQ guides, comparisons and research

From the blog

Recent RabbitMQ articles

Next step

Need this done on your cluster?

AceMQ's senior RabbitMQ engineers support 130+ enterprise clients in 26+ countries under a 15-minute emergency SLA, with direct escalation to the RabbitMQ core team.