<p>I am trying to setup RabbitMQ Cluster on K8S Cluster (CentOS 7) but it errored with</p>
<pre><code>2021-07-01 16:30:10.048 [error] &lt;0.273.0&gt; Failed to fetch a list of nodes from Kubernetes API: {failed_connect,[{to_address,{&quot;kubernetes.default&quot;,443}}, {inet,[inet],nxdomain}]}
</code></pre>
<p>I tried debugging the issue but I am not sure what's missing</p>
<p><strong>nslookup output</strong></p>
<pre><code>[root@re-devk8s-control01 tmp]# nslookup kubernetes.default
Server:         174.25.1.14
Address:        174.25.1.14#53

** server can't find kubernetes.default: NXDOMAIN
</code></pre>
<p><strong>dnsutils output</strong></p>
<pre><code>[root@re-devk8s-control01 tmp]#  kubectl exec -i -t dnsutils -- cat /etc/resolv.conf
nameserver 10.96.0.10
search default.svc.cluster.local svc.cluster.local cluster.local awstruewind.local
options ndots:5
</code></pre>
<p><strong>/etc/resolv.conf</strong></p>
<pre><code>[root@re-devk8s-control01 tmp]# cat /etc/resolv.conf
# Generated by NetworkManager
search ourdomain.local
nameserver 174.25.1.14
</code></pre>
<p><strong>KubeDNS log</strong> and I see few errors in it</p>
<pre><code>[root@re-devk8s-control01 tmp]# kubectl logs --namespace=kube-system -l k8s-app=kube-dns
.:53
[INFO] plugin/reload: Running configuration MD5 = db32ca3650231d74073ff4cf814959a7
CoreDNS-1.8.0
linux/amd64, go1.15.3, 054c9ae
[ERROR] plugin/errors: 2 610092700101479936.1385205460227937641. HINFO: read udp 10.244.0.31:47645-&gt;174.25.1.14:53: read: no route to host
[ERROR] plugin/errors: 2 610092700101479936.1385205460227937641. HINFO: read udp 10.244.0.31:60675-&gt;174.25.1.14:53: read: no route to host
</code></pre>
<p>Though there were many similar posts in SO, I was unable to find out the root cause</p>

<p>I found the following link from SO which helped me to resolve the issue <a href="https://stackoverflow.com/questions/45805483/kubernetes-pods-cant-resolve-hostnames">KubeDNS Masquerade</a></p>
<pre><code>firewall-cmd --list-all
  ... 
  masquerade: yes
</code></pre>
<p>Enable if it's &quot;no&quot;:</p>
<pre><code>firewall-cmd --add-masquerade --permanent
firewall-cmd --reload
</code></pre>
