<p>I wish to sniff and extract all DNS records from kubernetes: clientIP,serverIP,date,QueryType etc...
I had set up a kuberenetes service.
It is online and running. There I created several containerized micro-services that generate DNS queries (HTTP requests to external addresses). How can I see sniff it ? Is there a way to extract logs with DNS records ?</p>

trung chum
<p>Given that you use CoreDNS as your cluster DNS service you can configure it to <a href="https://github.com/coredns/coredns/blob/master/plugin/log/README.md" rel="nofollow noreferrer">log</a> queries, errors etc. to <code>stdout</code>. CoreDNS have been available as an alternative to <code>kube-dns</code> since k8s version 1.11, so if you're running a cluster of version >1.11 there's a good chance that you're using CoreDNS.</p>

<p>The CoreDNS service usually™️ lives in the <code>kube-system</code> namespace and can be reconfigured using the provided ConfigMap.</p>

<p>Example on how to log everything to <code>stdout</code>, taken from the <a href="https://github.com/coredns/coredns/tree/master/plugin/log" rel="nofollow noreferrer">README</a>:</p>

<pre><code>. {
    ...
    log
    ...
}
</code></pre>

<p>When you've reconfigured CoreDNS you can check the Pod logs with:</p>

<p><code>kubectl logs -n kube-system &lt;POD NAME&gt;</code></p>
