Skip to content

binarin/rabbit-on-k8s-standalone

Repository files navigation

RabbitMQ cluster on k8s suitable for OpenStack control plane workloads

Choices and tradeoffs are explained in detail at https://www.mirantis.com/blog/clustered-rabbitmq-kubernetes/

Steps to reproduce the setup on the minikube

  • Start minikube with you preferred defults
    minikube start --cpus=2 --memory=4096 --vm-driver=kvm
        
  • Create a namespace so you can easily reset an environment when something goes wrong
    kubectl create namespace demo
        
  • Make some etcd installation available under etcd name
    kubectl run etcd --image=microbox/etcd --port=4001 --namespace=demo -- --name etcd
    kubectl --namespace=demo expose deployment etcd
        
  • Build a Docker image
    eval $(minikube docker-env)
    docker build . -t rabbitmq-autocluster
        
  • Initialize k8s secret for erlang cookie
    kubectl create secret generic --namespace=demo erlang.cookie --from-file=./erlang.cookie
        
  • Deploy RabbitMQ cluster
    kubectl create -f rabbitmq.yaml
        
  • Check that clustering indeed worked
    FIRST_POD=$(kubectl get pods --namespace demo -l 'app=rabbitmq' -o jsonpath='{.items[0].metadata.name }')
    kubectl exec --namespace=demo $FIRST_POD rabbitmqctl cluster_status
        

    And we should see some output similar to the following one (where the most important bit of information is that nodes and running_nodes both contain 3 names):

    Cluster status of node '[email protected]' ...
    [{nodes,[{disc,['[email protected]','[email protected]',
                    '[email protected]']}]},
     {running_nodes,['[email protected]','[email protected]','[email protected]']},
     {cluster_name,<<"rabbit@rabbitmq-deployment-861116474-cmshz">>},
     {partitions,[]},
     {alarms,[{'[email protected]',[]},
              {'[email protected]',[]},
              {'[email protected]',[]}]}]
    
        

About

An example on how to setup RabbitMQ cluster in k8s

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages