Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Container runtime network not ready: cni config uninitialized

I'm installing kubernetes(kubeadm) on centos VM running inside Virtualbox, so with yum I installed kubeadm, kubelet and docker.

Now while trying to setup cluster with kubeadm init --pod-network-cidr=192.168.56.0/24 --apiserver-advertise-address=192.168.56.33/32 i run into the following error :

Unable to update cni config: No networks found in /etc/cni/net.d

Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized

So I checked, no cni folder in /etc even that kubernetes-cni-0.6.0-0.x86_64 is installed. I Tried commenting KUBELET_NETWORK_ARGS in /etc/systemd/system/kubelet.service.d/10-kubeadm.conf but it didn't work.

PS:

  • I'm installing behind proxy.

  • I have multiple network adapters:

    • NAT : 10.0.2.15/24 for Internet

    • Host Only : 192.168.56.33/32

    • And docker interface : 172.17.0.1/16

Docker version: 17.12.1-ce
kubectl version : Major:"1", Minor:"9", GitVersion:"v1.9.3"
Centos 7

like image 567
BOUKANDOURA Mhamed Avatar asked Mar 05 '18 14:03

BOUKANDOURA Mhamed


People also ask

What is CNI network plugin?

What is CNI? A CNI plugin is responsible for inserting a network interface into the container network namespace (e.g., one end of a virtual ethernet (veth) pair) and making any necessary changes on the host (e.g., attaching the other end of the veth into a bridge).

What CNI does Minikube use?

A vanilla minikube installation ( minikube start ) does not support any NetworkPolicies, since the default CNI, Kindnet, does not support Network Policies, by design. However, minikube can support NetworkPolicies if a supported CNI, such as Calico, is installed.

How do I check my CNI in Kubernetes?

Actually one pod will be created for one node. In addition to this answer you can also check which one you have by running command ls /etc/cni/net. d . It will show your cni's conf.


2 Answers

Add pod network add-on

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

If flannel doesn't work, then try calico -

curl https://docs.projectcalico.org/manifests/calico-typha.yaml -o calico.yaml

kubectl apply -f calico.yaml
like image 161
umesh torawane Avatar answered Oct 07 '22 19:10

umesh torawane


There are several points to remember when setting up the cluster with "kubeadm init" and it is clearly documented on the Kubernetes site kubeadm cluster create:

  • "kubeadm reset" if you have already created a previous cluster
  • Remove the ".kube" folder from the home or root directory
  • (Also stopping the kubelet with systemctl will allow for a smooth setup)
  • Disable swap permanently on the machine, especially if you are rebooting your linux system
  • And not to forget, install a pod network add-on according to the instructions provided on the add on site (not Kubernetes site)
  • Follow the post initialization steps given on the command window by kubeadm.

If all these steps are followed correctly then your cluster will run properly.

And don't forget to do the following command to enable scheduling on the created cluster:

kubectl taint nodes --all node-role.kubernetes.io/master-

About how to install from behind proxy you may find this useful:

install using proxy

like image 12
i-tms Avatar answered Oct 07 '22 18:10

i-tms