<p>I am trying to access a host that sits in another server (but on my network) from inside the pod of deployment and I am using <code>microk8s</code>.</p>
<p>The thing is that on the server where I have <code>microk8s</code> installed I can easily ping it by <code>ping my-network-host.qa.local</code>. But when I go inside the pod with <code>microk8s kubectl exec -it pod_name -- /bin/bash</code> and I do <code>ping my-network-host.qa.local</code> it says: <code>Name or service not known</code>.</p>
<p>And when I connect to a VPN on my computer to be on that network and I deploy it locally using <code>docker-desktop kubernetes</code> I can ping that host from within the pod. So I think the problem sits in <code>microk8s</code> which is not letting my pod use my network.</p>
<p>Is there any way to tell microk8s to use my hosts from my network?</p>
<p>p.s. I can ping the <code>ip</code> of that server from the pod, but I am not being able to ping the host from the pod</p>

Ertan Hasani
<p>Based on <a href="https://stackoverflow.com/a/62678275/11338984">another answer</a> that I found on StackOverflow, i managed to fixed it.</p>
<p>There were 2 changes needed to make it work:</p>
<p>Update <strong>kubelet configuration</strong> to use <code>resolv-conf</code>:</p>
<pre><code>sudo echo &quot;--resolv-conf=/run/systemd/resolve/resolv.conf&quot; &gt;&gt; /var/snap/microk8s/current/args/kubelet
</code></pre>
<p>Restart kubelet service:</p>
<pre><code>sudo service snap.microk8s.daemon-kubelet restart
</code></pre>
<p>Then change the <strong>CoreDNS forward</strong> to point to your nameserver:</p>
<p>First open coredns config map so you can edit it</p>
<pre><code>sudo microk8s.kubectl edit configmap coredns -n kube-system
</code></pre>
<p>and update the file at</p>
<pre><code>forward . 8.8.8.8 8.8.4.4 #REMOVE THIS LINE
forward . xxx.xxx.xxx.xxx #ADD THIS WITH YOUR IP
</code></pre>
<p>You can get eth0 DNS address:</p>
<pre><code>nmcli dev show 2&gt;/dev/null | grep DNS | sed 's/^.*:\s*//'
</code></pre>
<p>On my case I already had the ip as nameserver on <code>/run/systemd/resolve/resolv.conf</code>.</p>
<p>Now just save the changes, and go inside your pods so you will be able to access them.</p>
<p>There is a comment in another post that suggest adding</p>
<pre><code>forward . /etc/resolv.conf
</code></pre>
<p>But that didnt work on my case.</p>
