<p>I created the <a href="/questions/tagged/kubernetes" class="post-tag" title="show questions tagged &#39;kubernetes&#39;" rel="tag"><img src="https://i.stack.imgur.com/8UH0j.png" height="16" width="18" alt="" class="sponsor-tag-img">kubernetes</a> cluster by using <a href="/questions/tagged/kubeadm" class="post-tag" title="show questions tagged &#39;kubeadm&#39;" rel="tag">kubeadm</a> <code>kubeadm init</code>.</p>

<p>I am getting error messages in <code>/var/log/messages</code>.</p>

<pre><code>Oct 20 10:09:52 aws08 kubelet: I1020 10:09:52.015921    7116
docker_manager.go:1787] DNS ResolvConfPath exists:
/var/lib/docker/containers/717adf7a8481637ac20a9ba103d8f97635a88bf05f18bd4299f0d164e48f2920/resolv.conf.
Will attempt to add ndots option: options ndots:5 Oct 20 10:09:52
aws08 kubelet: I1020 10:09:52.015963    7116 docker_manager.go:2121]
Calling network plugin cni to setup pod for
kube-dns-2247936740-cjij4_kube-system(3b296413-96aa-11e6-8c40-02fff663a168)
Oct 20 10:09:52 aws08 kubelet: E1020 10:09:52.015982    7116
docker_manager.go:2127] Failed to setup network for pod
"kube-dns-2247936740-cjij4_kube-system(3b296413-96aa-11e6-8c40-02fff663a168)"
using network plugins "cni": cni config unintialized; Skipping pod Oct
20 10:09:52 aws08 kubelet: I1020 10:09:52.018824    7116
docker_manager.go:1492] Killing container
"717adf7a8481637ac20a9ba103d8f97635a88bf05f18bd4299f0d164e48f2920
kube-system/kube-dns-2247936740-cjij4" with 30 second grace period
</code></pre>

<p>The DNS pod is failing:</p>

<pre><code>kube-system   kube-dns-2247936740-j5rtc        0/3       ContainerCreating   21         1h
</code></pre>

<p>If I disabled <a href="https://github.com/containernetworking/cni" rel="nofollow noreferrer">CNI</a>, the DNS pod is running. But the issue for DNS persists.</p>

<p>The method to disable cni is to comment the <code>KUBELET_NETWORK_ARGS</code> line in <code>/etc/systemd/system/kubelet.service.d/10-kubeadm.conf</code> and restart <code>kubelet</code> service</p>

<pre><code>[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--kubeconfig=/etc/kubernetes/kubelet.conf --require-kubeconfig=true"
Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true"
# Environment="KUBELET_NETWORK_ARGS=--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
Environment="KUBELET_DNS_ARGS=--cluster-dns=100.64.0.10 --cluster-domain=cluster.local"
Environment="KUBELET_EXTRA_ARGS=--v=4"
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_EXTRA_ARGS
</code></pre>

<p>followed by:</p>

<p>sudo systemctl restart kubelet</p>

<p>I'm guessing that you forgot to <a href="http://kubernetes.io/docs/getting-started-guides/kubeadm/#installing-a-pod-network" rel="nofollow noreferrer">setup the pod network</a>.</p>

<p>From the documentation:</p>

<blockquote>
  <p>It is necessary to do this before you try to deploy any applications to your cluster, and before <code>kube-dns</code> will start up. Note also that <code>kubeadm</code> only supports CNI based networks and therefore <code>kubenet</code> based networks will not work.</p>
</blockquote>

<p>You can install a pod network add-on with the following command:</p>

<pre><code>kubectl apply -f &lt;add-on.yaml&gt;
</code></pre>

<p>Example:</p>

<pre><code>kubectl create -f https://git.io/weave-kube
</code></pre>

<p>To install <a href="https://www.weave.works/docs/net/latest/kube-addon/" rel="nofollow noreferrer">Weave Net</a> add-on.</p>

<p>After you have done this, you might need to recreate kube-dns pod.</p>
