<p>I have a k8s cluster with three masters, two workers, and an external haproxy and use flannel as a cni.
The coredns have problems, and their status is running, but they don't become ready.</p>
<p>Coredns log</p>
<p><img src="https://i.stack.imgur.com/lFNGV.png" alt="1" /></p>
<p>I get the logs of this pod, and I get this message:</p>
<blockquote>
<p>[INFO] plugin/ready: Still waiting on: &quot;Kubernetes.&quot;</p>
</blockquote>
<p>What I do to solve this problem but didn't get any result:<br />
1- check ufw and disable it.<br />
2- check IPtables and flush them.<br />
3- check Kube-proxy logs.<br />
4- check the haproxy, and it is accessible from out and all servers in the cluster.<br />
5- check nodes network.<br />
7- reboot all servers at the end. :))</p>
<p>I get describe po :</p>
<p><a href="https://i.stack.imgur.com/1S5ux.png" rel="nofollow noreferrer">describe pod</a></p>

mona moghadampanah
<h3>Lets see your CoreDNS works at all?</h3>
<ul>
<li>You can crete a simple pod and go inside and from there, curl Services via <code>IP:PORT</code> &amp; <code>Service-name:PORT</code>
<pre class="lang-bash prettyprint-override"><code>kubectl run -it --rm test-nginx-svc --image=nginx  -- bash
</code></pre>
</li>
</ul>
<ol>
<li>IP:PORT
<pre class="lang-bash prettyprint-override"><code>curl http://&lt;SERVICE-IP&gt;:8080
</code></pre>
</li>
<li>DNS
<pre class="lang-bash prettyprint-override"><code>curl http://nginx-service:8080
</code></pre>
</li>
</ol>
<p>If you couldn't curl your service via <code>Service-name:PORT</code> then you probably have a DNS Issue....</p>
<hr />
<h4>CoreDNS</h4>
<p>Service Name Resolution Problems?</p>
<ul>
<li>Check CoreDNS Pods are running and accessible?</li>
<li>Check CoreDNS logs</li>
</ul>
<pre class="lang-bash prettyprint-override"><code>kubectl run -it test-nginx-svc --image=nginx -- bash
</code></pre>
<ul>
<li>Inside the Pod
<pre class="lang-bash prettyprint-override"><code>cat /etc/resolv.conf 
</code></pre>
</li>
<li>The result would look like:
<pre><code>nameserver 10.96.0.10 # IP address of CoreDNS
search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
</code></pre>
</li>
</ul>
<hr />
<h3>If It is NOT working:</h3>
<p>I suggest to try re-install it via <a href="https://github.com/flannel-io/flannel" rel="nofollow noreferrer">official docs</a> or <a href="https://github.com/flannel-io/flannel/issues/1426" rel="nofollow noreferrer">helm chart</a></p>
<p>OR</p>
<p>Try onther CNIs like <a href="https://www.weave.works/docs/net/latest/kubernetes/kube-addon/" rel="nofollow noreferrer">weave</a></p>
<hr />
<p><a href="https://github.com/alifiroozi80/CKA/tree/main/CKA#coredns" rel="nofollow noreferrer">Source</a></p>
