<p>I have an older Kubernetes cluster (running with coreDNS) with some nodes.
Jenkins launches new pods inside this cluster every time a pipeline starts.
The pod's specs look like:</p>
<pre><code>apiVersion: &quot;v1&quot;
kind: &quot;Pod&quot;
metadata:
  name: &quot;test&quot;
spec:
  containers:
  - image: &quot;docker_image:1.0&quot;
    name: &quot;jnlp&quot;
    volumeMounts:
    - mountPath: &quot;/home/user&quot;
      name: &quot;home-volume&quot;
      readOnly: false
  dnsPolicy: &quot;Default&quot;
  hostNetwork: true
  nodeSelector:
    beta.kubernetes.io/os: &quot;linux&quot;
    kubernetes.io/hostname: &quot;node_to_run_on&quot;
  volumes:
  - hostPath:
      path: &quot;/home/user&quot;
    name: &quot;home-volume&quot;
</code></pre>
<p>Everything was fine until now using this configuration. Now a new Ubuntu machine was added to the cluster  (using the same older ansible playbook) and, inside the pod launched by Jenkins, the DNS settings get overwritten (in conclusion the pod cannot communicate with Jenkins).
Launching a container (using docker run -it -v $HOME:$HOME --network host docker_image:1.0 /bin/bash) everything is fine, the DNS settings are as expected.</p>
<p>I want to mention that it is required to run the pods using network host because some hosts are connected to the corporate network via VPN. Also the current host (with the mentioned issue) is connected via VPN.</p>

Ciprian Vintea
<p>The problem was fixed by adding:</p>
<pre><code>dnsPolicy: &quot;None&quot;
dnsConfig:
  nameservers:
  - IP1
  - IP2
  searches:
  - domain
</code></pre>
<p>This forces the new container to have the given config in its /etc/resolv.conf file.</p>
