how to assign hostname for rabbitmq cluster on Azure Kubernetes Service

4/16/2019

Dears, I am trying to setup Rabbitmq cluster on Azure Kubernetes Service.

I am using the example yaml files provided here: https://github.com/rabbitmq/rabbitmq-peer-discovery-k8s/tree/master/examples/k8s_statefulsets

I got this error and pod keep restarting:

Failed to get nodes from k8s - {failed_connect,[{to_address,{"kubernetes.default.svc.cluster.local",443}},
                 {inet,[inet],nxdomain}]}

I know the meaning of the error. but, what grinds my gears is I don't know how to assign a hostname for the cluster. or from where I got the right one!

I've searched the entire Internet, I can find any useful answer for this question. all answers from kind "you need to specify your host name" ... OK i really need to do that .. but how?

this line from the rabbitmq configurations:

cluster_formation.k8s.host = kubernetes.default.svc.cluster.local 

and it's a default value. I don't what is the right value? do I need to create something? to get specific hostname from somewhere?

-- Ahmed Metwally
azure
kubernetes
rabbitmq

1 Answer

4/17/2019

OK guys,

after working with two of my colleagues in this issue. we've solved the issue by recreating the AKS with defined --service-cidr and --dns-service-ip

because if you left them blank, Azure will create unrealistic values for them. even when you select a specific subnet!!

moreover, the --dns-service-ip must be the 10th ip of the defined range!!

az aks create `
--location region `
--resource-group rgname `
--vnet-subnet-id ***** `
--name clustername `
--node-count 2 `
--service-principal ****
--client-secret ****
--network-plugin azure `
--docker-bridge-address 172.17.0.1/16 `
--service-cidr 10.1.1.0/24 `
--dns-service-ip 10.1.1.10 `
--generate-ssh-keys
-- Ahmed Metwally
Source: StackOverflow