17

I am trying to configure a 2 node Kubernetes cluster. First I am trying to configure the master node of the cluster on a CentOS VM. I have initialized the cluster using 'kubeadm init --apiserver-advertise-address=172.16.100.6 --pod-network-cidr=10.244.0.0/16' and deployed the flannel network to the cluster. But when I do 'kubectl get nodes', I get the following output ----

[root@kubernetus ~]# kubectl get nodes
NAME         STATUS     ROLES    AGE   VERSION
kubernetus   NotReady   master   57m   v1.12.0

Following is the output of 'kubectl get pods --all-namespaces -o wide ' ----

[root@kubernetus ~]# kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                                 READY   STATUS    RESTARTS   AGE   IP             NODE         NOMINATED NODE
kube-system   coredns-576cbf47c7-9x59x             0/1     Pending   0          58m   <none>         <none>       <none>
kube-system   coredns-576cbf47c7-l52wc             0/1     Pending   0          58m   <none>         <none>       <none>
kube-system   etcd-kubernetus                      1/1     Running   2          57m   172.16.100.6   kubernetus   <none>
kube-system   kube-apiserver-kubernetus            1/1     Running   2          57m   172.16.100.6   kubernetus   <none>
kube-system   kube-controller-manager-kubernetus   1/1     Running   1          57m   172.16.100.6   kubernetus   <none>
kube-system   kube-proxy-hr557                     1/1     Running   1          58m   172.16.100.6   kubernetus   <none>
kube-system   kube-scheduler-kubernetus            1/1     Running   1          57m   172.16.100.6   kubernetus   <none>

coredns is in a pending state for a very long time. I have removed docker and kubectl, kubeadm, kubelet a no of times & tried to recreate the cluster, but every time it shows the same output. Can anybody help me with this issue?

Rot-man
  • 18,045
  • 12
  • 118
  • 124
Aditya Datta
  • 567
  • 2
  • 7
  • 17
  • 2
    First step for any problem is to get the logs - use `kubectl logs podname --namespace=kube-system` and also check if there is something in the events with the `kubectl get events --namespace=kube-system` command. – Praveen Sripati Oct 02 '18 at 13:38
  • 1
    I have two coredns pods which are in pending state . Hence I tried ' kubectl logs coredns-576cbf47c7-9x59x --namespace=kube-system ' and 'kubectl logs coredns-576cbf47c7-l52wc --namespace=kube-system' but it did'nt show any output . – Aditya Datta Oct 02 '18 at 13:48
  • 1
    For the command 'kubectl get events --namespace=kube-system' , I got some warnings ---- 62m Warning FailedScheduling Pod 0/1 nodes are available: 1 node(s) had taints that the pod didn't tolerate. 88m Warning Unhealthy Pod Liveness probe failed: Get https://172.16.100.6:6443/healthz: net/http: TLS handsh ake timeout. 88m Warning Unhealthy Pod Liveness probe failed: HTTP probe failed with statuscode: 403 – Aditya Datta Oct 02 '18 at 13:49
  • I also tried systemctl status kubelet -l and there were some errors --- Unable to update cni config: No networks found in /etc/cni/net.d ..... Oct 02 19:21:32 kubernetus kubelet[19007]: E1002 19:21:32.886170 19007 kubelet.go:2167] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized – Aditya Datta Oct 02 '18 at 13:52
  • 1
    Is that really `kubernetus`? – Rico Oct 02 '18 at 16:34
  • The commands itself show its kubernetes !!! – Aditya Datta Oct 02 '18 at 20:27
  • problem fixed?? @AdityaDatta – AATHITH RAJENDRAN Sep 23 '19 at 12:08
  • First setup container n/w using calico or any other solution to put your coreDNS in ready state. – AniketGole Sep 21 '22 at 21:19

7 Answers7

10

Try to install Pod network add-on (Base on this guide).

Run this line:

kubectl apply -f https://docs.projectcalico.org/v3.14/manifests/calico.yaml
Ben Even Tsur
  • 191
  • 2
  • 4
3

Unable to update cni config: No networks found in /etc/cni/net.d ..... Oct 02 19:21:32 kubernetus kubelet[19007]: E1002 19:21:32.886170 19007 kubelet.go:2167] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized

According to this error, you forgot to initialize a Kubernetes Pod network add-on. Looking at your settings, I suppose it should be Flannel.

Here is the instruction from the official Kubernetes documentation:

For flannel to work correctly, you must pass --pod-network-cidr=10.244.0.0/16 to kubeadm init.

Set /proc/sys/net/bridge/bridge-nf-call-iptables to 1 by running sysctl net.bridge.bridge-nf-call-iptables=1 to pass bridged IPv4 traffic to iptables’ chains. This is a requirement for some CNI plugins to work, for more information please see here.

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.10.0/Documentation/kube-flannel.yml

Note that flannel works on amd64, arm, arm64 and ppc64le, but until flannel v0.11.0 is released you need to use the following manifest that supports all the architectures:

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/c5d10c8/Documentation/kube-flannel.yml

For more information, you can visit this link.

Artem Golenyaev
  • 2,568
  • 12
  • 20
  • Thanks for the info. You are absolutely right . I had applied the flannel network and there was no error in it . I used ' kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml ' to apply flannel network but when it did not work I used the above 'kubectl apply' commands which you have provided but the situation was same. This is an issue with kubernetes version 1.12 . That's why I used kubernetes version 1.11.0 and it is working properly now . I don't know what is the issue with version 1.12 but old versions are running successfully . – Aditya Datta Oct 03 '18 at 11:42
  • But according to your `kubectl get pods --all-namespaces -o wide`, you had no Flannel Pods – Artem Golenyaev Oct 03 '18 at 12:18
  • Yes, that was the issue. I had applied flannel network on my cluster using all the three 'kubectl apply' syntaxes and I did not get any error while executing this command but it was not reflecting there . However , when I backtracked to version 1.11.0, then the cluster was configured properly . Now I have three flannel pods ----- one for master & two for slave nodes . – Aditya Datta Oct 03 '18 at 12:48
  • I am using Kubernetes 1.12 and I am running into this isssue. I have setup Flannel using the `kubectl apply` syntax from the documentation but coredns pods are not starting up. – lanoxx Oct 09 '18 at 11:54
  • It seems that this message appears when one has not yet joined a node to the master. I think the documentation is misleading in this case because it states: *And once the CoreDNS pod is up and running, you can continue by joining your nodes.* Which let me to understand that I need to get the flannel cluster network setup before I can join a node to the master. – lanoxx Oct 09 '18 at 12:04
2

For the Kubernetes cluster to be available, the cluster should have a Container Networking Interface (CNI). A pod-network is required to be configured for the dns pod to be functional.

Install any of the CNI Providers like: - Flannel - Calico - Canal - WeaveNet, etc.,

Without this, the hosted Kubernetes cluster would have the master in the NotReady State.

Sandy
  • 946
  • 11
  • 14
0

Check if docker and kubernetes are using the same cgroup driver. I faced the same issue (CentOS 7, kubernetes v1.14.1), and setting same cgroup driver (systemd) fixed it.

0

I installed kubernetes with 1 master + 1 work-node.
After I made kubeadm init ..., I faced two issues:

  1. On the master node, the coredns were pending.
  2. On the work-node, kubectl command didn't work out

On the work-node, I did the following and fixed the both issues:

mkdir -p $HOME/.kube

sudo cp -i /etc/kubernetes/kubelet.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config**
Sean Lee
  • 11
  • 1
  • 3
0

For me, I've restarted the system and re-applied calico.yaml, coredns and calico pods started creating.

0

take this solution at least priority and try changing instance type (preferably higher cpu core/ram) in my case i have changed linux instance t3.micro to t2.medium and its works

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 24 '22 at 08:09