{"id":16179230,"url":"https://github.com/jonashackt/rabbitmq-microk8s","last_synced_at":"2026-03-18T18:17:00.134Z","repository":{"id":147270055,"uuid":"617355816","full_name":"jonashackt/rabbitmq-microk8s","owner":"jonashackt","description":"Example project showing how to run RabbitMQ on MicroK8s","archived":false,"fork":false,"pushed_at":"2025-08-21T22:00:27.000Z","size":595,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-22T00:16:09.135Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonashackt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-03-22T08:11:22.000Z","updated_at":"2025-08-21T22:00:30.000Z","dependencies_parsed_at":"2023-04-12T15:17:14.334Z","dependency_job_id":"ff2af38a-ffea-409c-a1ac-c1ee99a4baae","html_url":"https://github.com/jonashackt/rabbitmq-microk8s","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonashackt/rabbitmq-microk8s","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Frabbitmq-microk8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Frabbitmq-microk8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Frabbitmq-microk8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Frabbitmq-microk8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonashackt","download_url":"https://codeload.github.com/jonashackt/rabbitmq-microk8s/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Frabbitmq-microk8s/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28850303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T05:26:09.045Z","updated_at":"2026-01-28T19:33:03.288Z","avatar_url":"https://github.com/jonashackt.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# rabbitmq-microk8s\n[![Build Status](https://github.com/jonashackt/rabbitmq-microk8s/workflows/provision/badge.svg)](https://github.com/jonashackt/rabbitmq-microk8s/actions)\n[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/jonashackt/rabbitmq-microk8s/blob/main/LICENSE)\n[![renovateenabled](https://img.shields.io/badge/renovate-enabled-yellow)](https://renovatebot.com)\n[![Configured with Kustomize](https://img.shields.io/badge/configured_by-Kustomize-455EA3.svg?logo=kubernetes\u0026logoColor=455EA3)](https://kustomize.io/)\n\nExample project showing how to run RabbitMQ on MicroK8s\n\n\n# Setup MicroK8s\n\n## Install MicroK8s\n\nOn Linux - especially Ubuntu - installation of MicroK8s is super easy: https://microk8s.io/docs/getting-started\n\nIf you're on a Mac, then [the following steps apply](https://microk8s.io/docs/install-macos):\n\n```shell\nbrew install ubuntu/microk8s/microk8s\n```\n\nOn MacOS MicroK8s is based on [Multipass](https://multipass.run/), which manages and runs Ubuntu VMs on every OS' native hypervisor (for Mac this is QEMU and HyperKit). So the next command will prompt you to download \u0026 install Multipass:\n\n```shell\nmicrok8s install\n```\n\nAfter successfull completion there should be something printed something like this:\n\n```shell\n2023-03-22T09:13:05+01:00 INFO Waiting for automatic snapd restart...\nmicrok8s (1.26/stable) v1.26.1 from Canonical✓ installed\nmicrok8s-integrator-macos 0.1 from Canonical✓ installed\nMicroK8s is up and running. See the available commands with `microk8s --help`.\n```\n\nYou can even log into the Multipass vm via:\n\n```shell\nmultipass shell microk8s-vm\n```\n\n## Access MicroK8s\n\n\u003e MicroK8s bundles its own version of kubectl for accessing Kubernetes.\n\nJust checking:\n\n```shell\nmicrok8s kubectl get nodes\n```\n\nThis works, but you may want to use your own `kubectl` including [kubectx or kubens](https://github.com/ahmetb/kubectx) and [k9s](https://k9scli.io/). This is also possible (see https://microk8s.io/docs/working-with-kubectl).\n\nFirst output the `kubeconfig` with:\n\n```shell\nmicrok8s config\n```\n\nIf you don't have a K8s cluster configured, you can copy the output directly into your K8s config\n\n```shell\nmkdir ~/.kube\nmicrok8s config \u003e ~/.kube/config\n```\n\n\u003e If you have already configured other Kubernetes clusters, __you should merge the output from the microk8s config with the existing config__ \n\nWatch out for existing lines like:\n\n```shell\napiVersion: v1\nclusters:\n## and\ncontexts:\n## and \ncurrent-context: xyz-cluster\n## and\nkind: Config\npreferences: {}\nusers:\n```\n\nYou shouldn't override them!\n\n\n## Enable MicroK8s Addons\n\nAt first have a look at the already enabled addons in MicroK8s:\n\n```shell\nmicrok8s status\n```\n\nOnly the following addons are pre-installed in MicroK8s:\n    api-server\n    controller-manager\n    scheduler\n    kubelet\n    cni\n    kube-proxy\n\n\u003e While this does deliver a pure Kubernetes experience with the smallest resource footprint possible, there are situations where you may require additional services. MicroK8s caters for this with the concept of “Addons” - extra services which can easily be added to MicroK8s. These addons can be enabled and disabled at any time, and most are pre-configured to ‘just work’ without any further set up.\n\nTo get more functionalities see https://microk8s.io/docs/addons for the full list of addons\n\nIn order to have a simple solution for `PersistenVolumes` our RabbitMQ cluster needs, we should enable the `hostpath-storage` addon:\n\n```shell\nmicrok8s enable hostpath-storage dns\n```\n\n\u003e The hostpath storage MicroK8s add-on can be used to easily provision PersistentVolumes backed by a host directory. It is ideal for local development\n\nAlso we [should enable DNS](https://microk8s.io/docs/addon-dns) to prevent the following error:\n\n```shell\n  Warning  MissingClusterDNS  10s (x4 over 35s)  kubelet            pod: \"hello-rabbit-server-0_default(c506abbb-68bf-4582-b288-fd4a2a3dc0c5)\". kubelet does not have ClusterDNS IP configured and cannot create Pod using \"ClusterFirst\" policy. Falling back to \"Default\" policy.\n```\n\n\n\n# RabbitMQ\n\n\n## Install RabbitMQ cluster operator\n\nWe want to check out the RabbitMQ operator:\n\nhttps://operatorhub.io/operator/rabbitmq-cluster-operator\n\nThere's a great quickstart guide covering all the steps we need:\n\nhttps://www.rabbitmq.com/kubernetes/operator/quickstart-operator.html\n\n\n\n### 0. Install rabbitmq kubectl plugin via krew\n\nLuckily there's a RabbitMQ kubectl plugin which will make working with RabbitMQ on Kubernetes much easier.\n\nTo install it we need to have [`krew` - the package manager for kubectl plugins](https://github.com/kubernetes-sigs/krew) in place. If you don't already have it installed, take [the following steps on a Mac](https://krew.sigs.k8s.io/docs/user-guide/setup/install/) (see the [docs for other OSses]https://krew.sigs.k8s.io/docs/user-guide/setup/install/)):\n\n```shell\n(\n  set -x; cd \"$(mktemp -d)\" \u0026\u0026\n  OS=\"$(uname | tr '[:upper:]' '[:lower:]')\" \u0026\u0026\n  ARCH=\"$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\\(arm\\)\\(64\\)\\?.*/\\1\\2/' -e 's/aarch64$/arm64/')\" \u0026\u0026\n  KREW=\"krew-${OS}_${ARCH}\" \u0026\u0026\n  curl -fsSLO \"https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz\" \u0026\u0026\n  tar zxvf \"${KREW}.tar.gz\" \u0026\u0026\n  ./\"${KREW}\" install krew\n)\n```\n\nThen add the following line to your `.bashrc` or `.zshrc`:\n\n```shell\nexport PATH=\"${KREW_ROOT:-$HOME/.krew}/bin:$PATH\"\n```\n\nNow `kubectl krew` should be ready to use!\n\nFinally install the rabbitmq kubectl plugin with:\n\n```shell\nkubectl krew install rabbitmq\n```\n\n\n### 1. Install the RabbitMQ cluster operator Helm\n\nIn the docs https://www.rabbitmq.com/kubernetes/operator/install-operator.html#helm-chart there is a reference to the bitnami Helm chart https://bitnami.com/stack/rabbitmq-cluster-operator/helm. We can install it using our own custom `Chart.yaml` to pin the version ([as described here](https://stackoverflow.com/questions/71765471/helm-how-to-pin-version-make-it-manageable-by-renovate-on-github/71765472#71765472)) in order to make this managable via Renovate bot. The `Chart.yaml` resides in `rabbitmq/install`:\n\n```yaml\napiVersion: v2\ntype: application\nname: rabbitmq-cluster-operator\nversion: 0.0.0 # unused\nappVersion: 0.0.0 # unused\ndependencies:\n  - name: rabbitmq-cluster-operator\n    repository: https://charts.bitnami.com/bitnami\n    version: 3.2.7\n```\n\nNow we can install the RabbitMQ cluster operator with the following commands:\n\n```shell\nhelm dependency update rabbitmq/install\nhelm upgrade -i rabbitmq-cluster-operator rabbitmq/install\n```\n\n\n### 2. Watch operator starting up\n\n```shell\nkubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=rabbitmq-cluster-operator,app.kubernetes.io/instance=rabbitmq-cluster-operator --namespace default --timeout=120s\n```\n\n\n\n## Create RabbitMQ Cluster\n\n### 1. Craft RabbitmqCluster CRD\n\nAs https://www.rabbitmq.com/kubernetes/operator/quickstart-operator.html suggests we can now start creating our first hello world RabbitMQ cluster using the `RabbitmqCluster` CRD:\n\n```yaml\napiVersion: rabbitmq.com/v1beta1\nkind: RabbitmqCluster\nmetadata:\n    name: hello-rabbit\n```\n\nSee the following examples https://github.com/rabbitmq/cluster-operator/tree/main/docs/examples/ to enhance the setup for TLS, production defaults and more.\n\n\n### 2. Install CRS via Kustomize\n\nThe [K8s config management tool Kustomize](https://kustomize.io/) helps us installing our CRD. First we need to create a [kustomization.yaml](rabbitmq/kustomization.yaml):\n\n```yaml\napiVersion: kustomize.config.k8s.io/v1beta1\nkind: Kustomization\n\nresources:\n  - hello-rabbit.yaml\n```\n\nNow we can simply install the CRD into our cluster via:\n\n```shell\nkubectl apply -k rabbitmq\n```\n\nWatch things coming up with\n\n```shell\nwatch kubectl get all\n```\n\nTo debug your setup use the following and have a look into the Events:\n\n```shell\nkubectl describe po hello-rabbit-server-0\n```\n\nOr try one of the following hints\n\n```shell\n# view CRD status\nkubectl get rabbitmqclusters.rabbitmq.com\n\n# view logs\nkubectl logs hello-world-server-0\n```\n\n\n### Tackling Readiness probe failed: dial tcp 10.1.254.78:5672: connect: connection refused\n\n```shell\nEvents:\n  Type     Reason     Age   From               Message\n  ----     ------     ----  ----               -------\n  Normal   Scheduled  53s   default-scheduler  Successfully assigned default/hello-rabbit-server-0 to microk8s-vm\n  Normal   Pulled     52s   kubelet            Container image \"docker.io/bitnami/rabbitmq:3.10.19-debian-11-r4\" already present on machine\n  Normal   Created    52s   kubelet            Created container setup-container\n  Normal   Started    52s   kubelet            Started container setup-container\n  Normal   Pulled     21s   kubelet            Container image \"docker.io/bitnami/rabbitmq:3.10.19-debian-11-r4\" already present on machine\n  Normal   Created    21s   kubelet            Created container rabbitmq\n  Normal   Started    21s   kubelet            Started container rabbitmq\n  Warning  Unhealthy  3s    kubelet            Readiness probe failed: dial tcp 10.1.254.78:5672: connect: connection refused\n```\n\nSeems that we don't get a connection https://stackoverflow.com/questions/74538398/k8s-readiness-probes-working-in-gke-not-in-microk8s-on-macos\n\nAll we need to do is to enable [the `host-access` plugin](https://microk8s.io/docs/addon-host-access) in Microk8s (see [this so answer](https://stackoverflow.com/a/75821978/4964553)):\n\n```shell\nmicrok8s enable host-access\n```\n\n\n## Access the RabbitMQ management UI\n\nExtract the `username` and `password` prior to accessing the management UI via:\n\n```shell\nusername=\"$(kubectl get secret hello-rabbit-default-user -o jsonpath='{.data.username}' | base64 --decode)\"\necho \"username: $username\"\npassword=\"$(kubectl get secret hello-rabbit-default-user -o jsonpath='{.data.password}' | base64 --decode)\"\necho \"password: $password\"\n```\n\nNow create a port forwarding and open your Browser at http://localhost:15672:\n\n```shell\nkubectl port-forward \"service/hello-rabbit\" 15672\n\n# or use rabbitmq kubectl plugin\nkubectl rabbitmq manage hello-rabbit\n```\n\n\u003e If you don't want to block your terminal, you can enhance the command by only running it in the background using a trailing `\u0026` like this: `kubectl port-forward \"service/hello-rabbit\" 15672 \u0026`. Now your terminal remains usable. If you want to stop the port forward though, you need to search for the process id via `ps -eaf | grep port-forward` and kill the second number in the first line like this:\n\n```shell\nps -eaf | grep port-forward\n  501 86828 27857   0  2:33pm ttys004    0:00.20 kubectl port-forward service/hello-rabbit 15672\n  501 88299 27857   0  2:39pm ttys004    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn port-forward\n$ kill 86828\n[1]  + 86828 terminated  kubectl port-forward \"service/hello-rabbit\" 15672\n```\n\nFinally the management UI should be available to us:\n\n![rabbitmq-management-ui.png](docs/screenshots/rabbitmq-management-ui.png)\n\n\n\n## Connecting an app to the cluster using perf-test load testing library\n\nThere's a great load testing application https://github.com/rabbitmq/rabbitmq-perf-test which is broadly used to test RabbitMQ installs. You can run it via the following commands:\n\n```shell\nusername=\"$(kubectl get secret hello-rabbit-default-user -o jsonpath='{.data.username}' | base64 --decode)\"\npassword=\"$(kubectl get secret hello-rabbit-default-user -o jsonpath='{.data.password}' | base64 --decode)\"\nservice=\"$(kubectl get service hello-rabbit -o jsonpath='{.spec.clusterIP}')\"\n\nkubectl run perf-test --image=pivotalrabbitmq/perf-test -- --uri amqp://$username:$password@$service\n```\n\nNow follow the logs with\n\n```shell\nkubectl logs --follow perf-test\n```\n\nNow you can see the messages also flowing inside the management ui:\n\n![](docs/screenshots/rabbitmq-management-ui-perftest.png)\n\nBut remember to stop the performance test again! Because \n\n\u003e perf-test is able to produce and consume about 25,000 messages per second.\n\nSo this will really get your cluster to the limits :)\n\nStop it with\n\n```shell\nkubectl delete po perf-test\n\n# or if you used the rabbitmq kubectl command\nkubectl delete job.batch perf-test\n```\n\n\n# Doing it all with GitHub Actions\n\nWe simply use https://github.com/marketplace/actions/microk8s-action to get Microk8s installed incl. our needed addons.\n\nSee [provision.yml](.github/workflows/provision.yml):\n\n```yaml\nname: provision\n\non: [push]\n\njobs:\n  microk8s-rabbitmq:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@master\n\n      - name: Install microk8s using actions/microk8s-action\n        uses: balchua/microk8s-actions@v0.3.0\n        with:\n          channel: '1.26/stable'\n          addons: '[\"dns\", \"host-access\", \"hostpath-storage\"]'\n\n      - name: Access microk8s\n        run: |\n          echo \"Check access to mikrok8s cluster\"\n          kubectl get nodes\n      \n      - name: Install RabbitMQ cluster operator\n        run: |\n          echo \"Install RabbitMQ using our Helm chart with pinned version\"\n          helm dependency update rabbitmq/install\n          helm upgrade -i rabbitmq-cluster-operator rabbitmq/install\n\n          echo \"Watch operator starting up - wrapped in until to prevent 'error: no matching resources found' from stopping the pipeline\"\n          until kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=rabbitmq-cluster-operator,app.kubernetes.io/instance=rabbitmq-cluster-operator --namespace default --timeout=120s; do : ; sleep 5; done\n\n      - name: Install RabbitMQ\n        run: |\n          echo \"Install CRDs via Kustomize\"\n          kubectl apply -k rabbitmq\n\n          echo \"Watch RabbitMQ coming up - wrapped in until to prevent 'error: no matching resources found' from stopping the pipeline\"\n          until kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=hello-rabbit --namespace default --timeout=120s; do : ; sleep 5; done\n\n      - name: Check if the RabbitMQ management UI is accessible\n        run: |\n          echo \"Extract username and password for RabbitMQ management UI\"\n          username=\"$(kubectl get secret hello-rabbit-default-user -o jsonpath='{.data.username}' | base64 --decode)\"\n          password=\"$(kubectl get secret hello-rabbit-default-user -o jsonpath='{.data.password}' | base64 --decode)\"\n\n          echo \"Create port forwarding to the management UI (in background using '\u0026' at the end to not block the terminal session)\"\n          kubectl port-forward \"service/hello-rabbit\" 15672 \u0026\n\n          echo \"Access the management UI via curl\"\n          until curl -u$username:$password localhost:15672/api/overview --connect-timeout 30; do : ; sleep 3; done\n```\n\n# Next steps\n\nCreating a HA setup using multiple (3) replicas of RabbitMQ like in this example https://github.com/rabbitmq/cluster-operator/tree/main/docs/examples/production-ready which should be based on a 3 nodes MicroK8s setup (https://microk8s.io/docs/high-availability).\n\n\n# Links\n\nhttps://www.rabbitmq.com/kubernetes/operator/quickstart-operator.html\n\nhttps://www.rabbitmq.com/kubernetes/operator/operator-overview.html\n\nhttps://blog.rabbitmq.com/posts/2020/08/deploying-rabbitmq-to-kubernetes-whats-involved/\n\n### Clustering and HA\n\nhttps://microk8s.io/docs/clustering\n\nhttps://microk8s.io/high-availability\n\nhttps://microk8s.io/docs/high-availability\n\nhttps://www.infracloud.io/blogs/setup-rabbitmq-ha-mode-kubernetes-operator/\n\nhttps://blog.rabbitmq.com/posts/2020/07/disaster-recovery-and-high-availability-101/\n\nhttps://www.rabbitmq.com/quorum-queues.html\n\n### Monitoring Prometheus\n\nhttps://www.rabbitmq.com/prometheus.html","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonashackt%2Frabbitmq-microk8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonashackt%2Frabbitmq-microk8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonashackt%2Frabbitmq-microk8s/lists"}