<p>Dears,
I am trying to setup Rabbitmq cluster on Azure Kubernetes Service.</p>

<p>I am using the example yaml files provided here:
<a href="https://github.com/rabbitmq/rabbitmq-peer-discovery-k8s/tree/master/examples/k8s_statefulsets" rel="nofollow noreferrer">https://github.com/rabbitmq/rabbitmq-peer-discovery-k8s/tree/master/examples/k8s_statefulsets</a></p>

<p>I got this error and pod keep restarting:</p>

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

<p>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!</p>

<p>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?</p>

<p>this line from the rabbitmq configurations:</p>

<pre><code>cluster_formation.k8s.host = kubernetes.default.svc.cluster.local 
</code></pre>

<p>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?  </p>

Meto
<p>OK guys, </p>

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

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

<p>moreover, the <code>--dns-service-ip</code> must be the 10th ip of the defined range!!</p>

<pre><code>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
</code></pre>
