<p>Can you simply summarize what the following two definitions do and when they should be used?</p>
<p><code>spec: hostNetwork: true dnsPolicy: ClusterFirstWithHostNet</code></p>
<p>I do not have enough knowledge about networking in Kubernetest and the articles I found are not understandable to me.</p>

Melek
<h2>hostNetwork: true</h2>
<p>When in doubt you can always use <code>explain</code> command:</p>
<pre><code>kubectl explain pod.spec.hostNetwork
</code></pre>
<pre><code>KIND:       Pod
VERSION:    v1

FIELD: hostNetwork &lt;boolean&gt;

DESCRIPTION:
    Host networking requested for this pod. Use the host's network namespace. If
    this option is set, the ports that will be used must be specified. Default
    to false.
</code></pre>
<p>This namespace is a network namespace, not the Kubernetes namespace. When pods are scheduled on a node (host machine), they get a new network namespace isolated from the host machine. If your pod specifically needs privileged host machine network access then you need this option. Pods running from the <a href="https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/" rel="nofollow noreferrer">Network plugin</a> in your cluster use this setting. Those pods get their <code>podIP</code> set to the host machine <code>IP</code> (which means they can use the host machine's <code>eth0</code> physical interface) it runs on.</p>
<h2>dnsPolicy: ClusterFirstWithHostNet</h2>
<p>The above setting for the pod means that you need cluster DNS resolution (via CoreDNS) as a normal pod even though you set <code>hostNetwork: true</code> (pods that are not running in the host network namespace). If you don't set it, Pod will use the host machine's DNS configuration for DNS resolution (where Pod cannot resolve k8s <code>services</code> and <code>endpoints</code>).</p>
<p><a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy" rel="nofollow noreferrer">Check DNS policy section in k8s docs for further details</a></p>
