RabbitMQ Cluster Operator Plugin for kubectl

This guide covers the RabbitMQ Cluster Operator plugin for kubectl. This plugin makes it easy to install the RabbitMQ Cluster Kubernetes Operator. into any Kubernetes instance and offers several commands for common workflows with RabbitMQ clusters.

The only prerequisites to using the plugin are a working installation of kubectl and krew.

  1. Install the plugin
  2. Using the plugin

Each plugin command automates many interactions with the kubernetes API and the RabbitMQ cluster operator. For a more detailed guide on using the operator and how to deploy Custom Resource objects it manages, see the Using RabbitMQ Cluster Operator page.

Install the plugin

Setup Krew

Krew is the plugin manager for kubectl command-line tool.

After installing krew, verify the installation:

kubectl krew

Install kubectl RabbitMQ plugin

With krew setup we can go ahead and install the RabbitMQ Cluster Operator plugin.

kubectl krew install rabbitmq

To verify the installation, get the list of available commands:

kubectl rabbitmq help
# USAGE:
#   Install RabbitMQ Cluster Operator (optionally provide image to use a relocated image or a specific version)
#     kubectl rabbitmq install-cluster-operator [IMAGE]
# [...]

Using the Plugin

Create a RabbitMQ cluster

kubectl rabbitmq create INSTANCE

This will create RabbitMQ cluster with some basic configuration where only the cluster name is configured.

Get a RabbitMQ cluster

kubectl rabbitmq get INSTANCE

Display all of the kubernetes resources associated with the named RabbitMQ cluster including pods, configmaps, statefulsets, services and secrets.

NAME                     READY   STATUS    RESTARTS   AGE
pod/hello-rmq-server-0   0/1     Pending   0          5h31m

NAME                               DATA   AGE
configmap/hello-rmq-plugins-conf   1      5h31m
configmap/hello-rmq-server-conf    2      5h31m

NAME                                READY   AGE
statefulset.apps/hello-rmq-server   0/1     5h31m

NAME                      TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)              AGE
service/hello-rmq         ClusterIP   10.100.156.4   none        5672/TCP,15672/TCP   5h31m
service/hello-rmq-nodes   ClusterIP   None           none        4369/TCP,25672/TCP   5h31m

NAME                             TYPE     DATA   AGE
secret/hello-rmq-default-user    Opaque   3      5h31m
secret/hello-rmq-erlang-cookie   Opaque   1      5h31m

List all RabbitMQ clusters

kubectl rabbitmq list

Displays all RabbitMQ clusters deployed by the RabbitMQ cluster operator on the target kubernetes instance.

Delete RabbitMQ cluster

kubectl rabbitmq delete INSTANCE

Deletes a RabbitMQ cluster, or multiple RabbitMQ clusters. When deleting multiple RabbitMQ clusters, provide a space separated list.

kubectl rabbitmq delete rmq1 rmq2 rmq3
kubectl rabbitmq secrets INSTANCE

Displays the default user secrets for the named RabbitMQ cluster

Open the Management UI

kubectl rabbitmq manage INSTANCE

Opens the RabbitMQ Management UI in a browser.

Set Log Level to debug

kubectl rabbitmq debug INSTANCE

Sets the log level on all nodes to debug. For a detailed breakdown on RabbitMQ logging see the Logging guide.

Tail Logs

kubectl rabbitmq tail INSTANCE

Attach to live log output from all RabbitMQ nodes. This requires the tail plugin for kubectl. Install it with

kubectl krew install tail

Observe

kubectl rabbitmq observe INSTANCE INDEX

Opens the rabbitmq-diagnostics observer interface for a given node.

Enable All Feature Flags

kubectl rabbitmq enable-all-feature-flags INSTANCE 

This command uses rabbitmqctl to enable all possible feature flags.

Pause Reconciliation

kubectl rabbitmq pause-reconciliation INSTANCE 

This adds the label "rabbitmq.com/pauseReconciliation=true" to the target RabbitMQ cluster. The label prevents the Operator from watching and updating the instance.

Resume Reconciliation

kubectl rabbitmq resume-reconciliation INSTANCE 

Instructs the operator to resume reconciliation for a RabbitMQ cluster.

List Instances with Paused Reconciliation

kubectl rabbitmq [list pause reconciliation instances](list-pause-reconciliation-instances) INSTANCE

Lists all instances that are not being reconciled by the operator.

Perf Test

kubectl rabbitmq perf-test INSTANCE --rate 100

Runs perf-test against an instance. You can pass as many perf test parameters as you like here.

To monitor PerfTest, add the following ServiceMonitor:

  apiVersion: monitoring.coreos.com/v1
  kind: ServiceMonitor
  metadata:
    name: kubectl-perf-test
  spec:
    endpoints:
    - interval: 15s
      targetPort: 8080
    selector:
      matchLabels:
        app: perf-test

Please submit feedback and feature requests for the RabbitMQ Cluster Operator on GitHub.

check-circle-line exclamation-circle-line close-line
Scroll to top icon