<p>I install kubernetes 1000 times but now it does not work.
I install kubectl kubeadm kubelet then </p>

<pre><code> sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=185.73.114.92
 kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
</code></pre>

<p>but I see coredns is in pending state</p>

<pre><code>kubectl get pods --all-namespaces
NAMESPACE     NAME                              READY   STATUS    RESTARTS   AGE
kube-system   coredns-5644d7b6d9-492q4          0/1     Pending   0          13m
kube-system   coredns-5644d7b6d9-cvwjg          0/1     Pending   0          13m
kube-system   etcd-amghezi                      1/1     Running   0          12m
kube-system   kube-apiserver-amghezi            1/1     Running   0          12m
kube-system   kube-controller-manager-amghezi   1/1     Running   0          12m
kube-system   kube-flannel-ds-amd64-fkxnf       1/1     Running   0          12m
kube-system   kube-proxy-pspw2                  1/1     Running   0          13m
kube-system   kube-scheduler-amghezi            1/1     Running   0          12m
</code></pre>

<p>and then I get describe of coredns</p>

<pre><code>kubectl describe pods coredns-5644d7b6d9-492q4 -n kube-system
Events:
  Type     Reason            Age        From               Message
  ----     ------            ----       ----               -------
  Warning  FailedScheduling  &lt;unknown&gt;  default-scheduler  0/1 nodes are available: 1 node(s) had taints that the pod didn't tolerate.
  Warning  FailedScheduling  &lt;unknown&gt;  default-scheduler  0/1 nodes are available: 1 node(s) had taints that the pod didn't tolerate.
</code></pre>

<p>I taint the node by </p>

<pre><code>kubectl taint nodes amghezi node-role.kubernetes.io/master-
</code></pre>

<p>It did not work
I see at </p>

<pre><code>journalctl -xe
message:docker: network plugin is not ready: cni config uninitialized

service docker status
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-09-22 17:29:45 CEST; 34min ago
     Docs: https://docs.docker.com
 Main PID: 987 (dockerd)
    Tasks: 20
   CGroup: /system.slice/docker.service
           └─987 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Sep 22 17:29:45 ubuntu systemd[1]: Started Docker Application Container Engine.
Sep 22 17:29:45 ubuntu dockerd[987]: time="2019-09-22T17:29:45.728818467+02:00" level=info msg="API listen on /var/run/docker.sock"
Sep 22 17:29:45 ubuntu dockerd[987]: time="2019-09-22T17:29:45.757401709+02:00" level=warning msg="failed to retrieve runc version: unknown output format: runc version spec: 1.0.1-dev\n"
Sep 22 17:29:45 ubuntu dockerd[987]: time="2019-09-22T17:29:45.786776798+02:00" level=warning msg="failed to retrieve runc version: unknown output format: runc version spec: 1.0.1-dev\n"
Sep 22 17:29:46 ubuntu dockerd[987]: time="2019-09-22T17:29:46.296798944+02:00" level=warning msg="failed to retrieve runc version: unknown output format: runc version spec: 1.0.1-dev\n"
Sep 22 17:29:46 ubuntu dockerd[987]: time="2019-09-22T17:29:46.364459982+02:00" level=warning msg="failed to retrieve runc version: unknown output format: runc version spec: 1.0.1-dev\n"
Sep 22 17:30:06 ubuntu dockerd[987]: time="2019-09-22T17:30:06.996299645+02:00" level=warning msg="failed to retrieve runc version: unknown output format: runc version spec: 1.0.1-dev\n"
Sep 22 17:30:41 ubuntu dockerd[987]: time="2019-09-22T17:30:41.633452599+02:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Sep 22 17:30:41 ubuntu dockerd[987]: time="2019-09-22T17:30:41.633831003+02:00" level=warning msg="d72e19bd0e929513a1c9092ec487e5dc3f3e009bdaa4d33668b610e86cdadf9e cleanup: failed to unmount IPC: umount /var/lib/docker/containers/d72e19bd0e929513a1c9092ec487e5dc3f3e009bdaa4d33668b610e86cdadf9e/mounts/shm, flags: 0x2
Sep 22 17:30:41 ubuntu dockerd[987]: time="2019-09-22T17:30:41.903058543+02:00" level=warning msg="Your kernel does not support swap limit capabilities,or the cgroup is not mounted. Memory limited without swap."
</code></pre>

<p>and let us see kubelet status</p>

<pre><code>Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
</code></pre>

yasin lachini
<p>I assume per given data outputs that the problem comes from <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/" rel="nofollow noreferrer">Kubelet</a> node agent, since <code>kubelet</code> primarily demands on <a href="https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins" rel="nofollow noreferrer"><em>CNI network plugin</em></a> installation. In order to automatically configure networking features for the Pods, <code>kubelet</code> starts each time <em>CNI addon</em> in prior Pod creation to set up  pod’s network interface as well. Furthermore, <a href="https://kubernetes.io/docs/tasks/administer-cluster/coredns/" rel="nofollow noreferrer"><em>CoreDNS</em></a> discovery service relies on overlay container network to be reachable for all cluster nodes.  </p>

<p>Although you've used <a href="https://github.com/coreos/flannel" rel="nofollow noreferrer">Flannel</a> CNI provider, <code>flannel</code> Pod is up and running, since <code>kubelet</code> can't create container interface for the particular <code>CoreDNS</code> Pods with lack of CNI configuration, I would recommend to reset <code>kubeadm</code> cluster with purging redundant component folder structure:</p>

<p><code>$ sudo kubeadm reset</code></p>

<p><code>$ sudo systemctl stop docker &amp;&amp; sudo systemctl stop kubelet</code></p>

<p><code>$ sudo rm -rf /etc/kubernetes/</code></p>

<p><code>$ sudo rm -rf .kube/</code></p>

<p><code>$ sudo rm -rf /var/lib/kubelet/</code></p>

<p><code>$ sudo rm -rf /var/lib/cni/</code></p>

<p><code>$ sudo rm -rf /etc/cni/</code></p>

<p><code>$ sudo rm -rf /var/lib/etcd/</code></p>

<p>Bootstrap K8s cluster via <code>kubeadm</code>:</p>

<p><code>$ sudo systemctl start docker &amp;&amp; sudo systemctl start kubelet</code></p>

<p><code>$ sudo kubeadm init ...</code></p>

<p>Further remove <code>node-role.kubernetes.io/master</code> taint and apply Flannel addon:</p>

<p><code>$ kubectl taint nodes --all node-role.kubernetes.io/master-</code></p>

<p><code>$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml</code></p>

<p>You might find also some useful information about <code>kubeadm</code> <a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/" rel="nofollow noreferrer"><em>troubleshooting</em></a> guide steps in the official K8s documentation.</p>
