<p>I am new to k8 and I am learning how DNS works inside a k8 cluster. I am able to get the contents of <code>/etc/resolv.conf</code> of a random pod in the default namespace but I am unable to get the contents <code>/etc/resolv.conf</code> of coredns pod in <code>kube-system</code> namespace.</p>
<pre><code>$&gt;kubectl exec kubia-manual-v2 -- cat /etc/resolv.conf
</code></pre>
<p><strong>Output:</strong>
<code>nameserver 10.96.0.10</code></p>
<pre><code>$&gt;kubectl exec coredns-74ff55c5b-c8dk6 --namespace kube-system -- cat /etc/resolv.conf
</code></pre>
<p><strong>Output:</strong></p>
<pre><code>OCI runtime exec failed: exec failed: container_linux.go:370: starting container process caused: exec: &quot;cat&quot;: executable file not found in $PATH: unknown

command terminated with exit code 126

</code></pre>
<p>It looks like the <code>cat</code> system binary is not present in the <code>$PATH</code>. So, I wanted to know how can I get the contents of <code>/etc/resol.conf</code> of coredns pod.</p>

<p>Coredns is using <a href="https://hub.docker.com/_/scratch/" rel="nofollow noreferrer">scratch</a> as the base layer running it's coredns binary. You can see the Dockerfile here for <a href="https://github.com/coredns/coredns/blob/master/Dockerfile" rel="nofollow noreferrer">reference</a>.</p>
<p>You can follow the instructions in <a href="https://stackoverflow.com/a/57395265/3833773">this SO post</a> to copy busybox into your coredns container and that will give you the ability to play around it. Keep in mind that you will probably have to ssh into the k8s node running this container to make this work.</p>
