<p>How can I prevent kube-dns from forwarding request to Google's name servers (8.8.8.8:53 and 8.8.4.4:53)?
I just want to launch pods only for internal use, which means containers in pods are not supposed to connect to the outside at all.
When a Zookeeper client connects to a Zookeeper server using hostname (e.g. zkCli.sh -server zk-1.zk-headless), it takes 10 seconds for the client to change its state from [Connecting] to [Connected].
The reason I suspect kube-dns is that, with pods' IP address, the client gets connected instantly.
When I take a look at the log of kube-dns, I found the following two lines:</p>

<pre><code>07:25:35:170773       1 logs.go:41] skydns: failure to forward request "read udp 10.244.0.13:43455-&gt;8.8.8.8:53: i/o timeout"
07:25:39:172847       1 logs.go:41] skydns: failure to forward request "read udp 10.244.0.13:42388-&gt;8.8.8.8:53: i/o timeout"
</code></pre>

<p>It was around 07:25:30 when the client starts to connect to the server.</p>

<p>I'm running Kubernetes on a private cluster where internal servers are communicating to internet via http_proxy/https_proxy, which means I cannot connect to 8.8.8.8 for name resolution, AFAIK.</p>

<p>I found the followings from <a href="https://github.com/skynetservices/skydns" rel="nofollow noreferrer">https://github.com/skynetservices/skydns</a>:</p>

<ul>
<li>The default value of an environmental variable named <strong>SKYDNS_NAMESERVERS</strong> is <strong>"8.8.8.8:53,8.8.4.4:53"</strong></li>
<li>I could achieve my purpose by setting <strong>no_rec</strong> to <strong>true</strong></li>
</ul>

<p>I've been initiating Kubernetes using kubeadm and I couldn't find a way to modify the environmental variable and set the property value of skydns.</p>

<p>How can I prevent kube-dns from forwarding request to the outside of an internal Kubernetes cluster which is deployed by kubeadm?</p>

<p>I don't think there is an option to completely prevent the <code>kube-dns</code> addon from forwarding requests. There certainly isn't an option directly in <code>kubeadm</code> for that.</p>

<p>Your best bet is to edit the <code>kube-dns</code> <code>Deployment</code> (e.g. <code>kubectl edit -n kube-system deploy kube-dns</code>) yourself after kubeadmin has started the cluster and change things to work for you.</p>

<p>You may want to try changing the upstream nameserver to something other than 8.8.8.8 that <em>is</em> accessible by the cluster. You should be able to do that by adding <code>--nameservers=x.x.x.x</code> to the <code>args</code> for the <code>kubedns</code> container.</p>
