<p>I am facing strange problem.</p>
<p>What I've done:</p>
<p>I deployed <strong>Rancher K3S</strong> cluster and there is a problem in dns resolving with debian based images. Domains are not resolved properly - it adds suffix to it with one of ours domain.</p>
<p>What I've found:</p>
<p><strong>Debian based image</strong> adds suffix with domain to the end. e.g. I ping google.com and its pinging google.com.example.com. (example.com is one of our domains - not specifing it because it is not important imo)</p>
<p>The same for curl google.com makes request to ip address of example.com . Even tried pure debian image and it is still doing the same issue.</p>
<p><strong>Alpine based images</strong> works fine (ping to google.com pings google.com, nslookup shows right ip address).</p>
<p><strong>Host server</strong> where k3s is installed also works fine (redhat os). Ping to google.com pings google.com.</p>
<p>Some additional data that can maybe help you:</p>
<p><strong>CoreDNS configmap</strong>
kubectl -n kube-system get configmap coredns -o go-template={{.data.Corefile}}</p>
<pre><code>.:53 {
    errors
    health
    ready
    kubernetes cluster.local in-addr.arpa ip6.arpa {
      pods insecure
      upstream
      fallthrough in-addr.arpa ip6.arpa
    }
    hosts /etc/coredns/NodeHosts {
      reload 1s
      fallthrough
    }
    prometheus :9153
    forward . 8.8.8.8
    cache 30
    loop
    reload
    loadbalance
}
</code></pre>
<p>Does anyone faced the same or similar problem?
Do you have some points to push me towards solving?</p>
<p>Thanks,
David</p>

Zoidik
<p>I faced similar issues with <code>k3s</code> (v.v1.19.3+k3s3) on <code>centos</code> 8 (not quite sure it has anything to do with the images' OS, though). <code>k3s</code> is a bit less plug and play that other distro like <code>microk8s</code>.</p>
<h2>Use local DNS parameter</h2>
<p>On each node, you could say that you want to use the host's resolv parameters. If <code>k3s</code> is managed as <strong>systemd service</strong> (which is probably the case), you could just edit <code>/etc/systemd/system/k3s.service.env</code> to add you system's <code>resolv.conf</code></p>
<pre><code>K3S_RESOLV_CONF=/etc/resolv.conf
</code></pre>
<p>and then restart the service</p>
<pre class="lang-sh prettyprint-override"><code>sudo systemctl status k3s
</code></pre>
<ul>
<li><strong>plus</strong>: the easiest solution, easily scriptable</li>
<li><strong>cons</strong>: you'll need to do it on each of your nodes (from what I understand). Different <code>resolv.conf</code> on different systems involves that the very same deployment might not act the same way depending on the nodes used by kube</li>
</ul>
<p><a href="https://rancher.com/docs/k3s/latest/en/installation/install-options/agent-config/#networking" rel="nofollow noreferrer">relevant documentation</a></p>
<h2>Use Global DNS</h2>
<p>Haven't tried but here is <a href="https://rancher.com/docs/rancher/v2.x/en/helm-charts/legacy-catalogs/globaldns/" rel="nofollow noreferrer">the doc</a></p>
