Pods are not starting. NetworkPlugin cni failed to set up pod

Running the following command resolved my issues:

kubeadm init --pod-network-cidr=10.244.0.0/16

For flannel as cni the api server needs to have the argument --pod-network-cidr=... to be set to the overlay.


You error message shows flanel subnet.evn file is missing. you need to fix flannel configuration first. What version of kubernetes your using?

network: open /run/flannel/subnet.env: no such file or directory"

if your using kubernetes 1.6 and above, we can use below yaml file to configure the flannel container process.

kubectl create -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml
kubectl create -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml