<p><strong>Not able to connect to internet from inside the pod</strong></p>
<p>My system Spec Include : I have created a Kubernetes cluster using 2 system one acts as master the other as worker node .</p>
<p>Operating System : NAME=&quot;Red Hat Enterprise Linux&quot; VERSION=&quot;8.3 (Ootpa)&quot; ID=&quot;rhel&quot;.</p>
<p>I installed the Kuberenetes clusted using the following the link (<a href="https://dzone.com/articles/kubernetes-installation-in-redhat-centos" rel="nofollow noreferrer">https://dzone.com/articles/kubernetes-installation-in-redhat-centos</a>)</p>
<p>I have tried both CALICO pod network and Flannel pod network for both  same issue is happening. Not able to connect to internet from inside the pod</p>
<p>See the below image for further details</p>
<p><a href="https://i.stack.imgur.com/92PvW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/92PvW.png" alt="enter image description here" /></a></p>
<p>you can see that all the pods are up and running.</p>
<p>My coredns pod is also up and running and the service for the respective is also up check the below image</p>
<p><a href="https://i.stack.imgur.com/473JE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/473JE.png" alt="enter image description here" /></a></p>
<p><strong>Debugging</strong></p>
<p>For debugging i tried using this link (<a href="https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/</a>)</p>
<p><strong>whenever i do nslookup it shows up the error saying (;; connection timed out; no servers could be reached ,command terminated with exit code 1)</strong></p>
<p>please have a look at the below image</p>
<p><a href="https://i.stack.imgur.com/HaDdU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HaDdU.png" alt="enter image description here" /></a></p>
<p>Can anyone please tell where exactly the problem lies . why is that from inside the pod i an not able to connect to the internet</p>
<p>Any help would be Appriciated Thank you.</p>

<p>There are couple of possibilities for this kind of issue:</p>
<ul>
<li><p>It could be that this is not an issue with CoreDNS itself but rather the Kubernetes networking problem where the traffic to ClusterIPs is not directed correctly to Pods. It could be that kube-proxy is responsinble for that.</p>
<p>Here's a <a href="https://kubernetes.io/docs/tasks/debug-application-cluster/debug-service/" rel="nofollow noreferrer">Kubernetes guide</a> about troubleshooting services.</p>
</li>
<li><p>Another issue very common for rhel/centos distributions is the issue with <code>nftables</code> backed is not compatible with kubernetes. <code>nftables</code> is available as a modern replacement for the kernel’s <code>iptables</code> subsystem.</p>
<p>The workaround for this is to use Calico since from v3.8.1+ it possible to the CNI to run on hosts which use iptables in NFT mode.  Setting the  <code>FELIX_IPTABLESBACKEND=NFT</code>  option will tell Calico to use the nftables backend. For now, this will need to be set explicitly.</p>
</li>
<li><p>Lastly it is very possible that your Pod network overlap with the host networks. Reference: <a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#pod-network" rel="nofollow noreferrer">Installing a Pod network add-on</a></p>
</li>
</ul>
