Skip to main content

k8s node NotReady:NetworkReady=false reason:NetworkPlugin NotReady;cni plugin not initialized

kubectl obtains the node node. When detecting the cluster status, the master and node are always in the NotReady state.

[root@master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master NotReady control-plane 27m v1.26.3
node NotReady <none> 80s v1.26.3

Check the pod status and find that coredns has been in the pending state.

[root@master ~]# kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-787d4945fb-rms8q 0/1 Pending 0 27m
kube-system coredns-787d4945fb-v9l5l 0/1 Pending 0 27m
kube-system etcd-master 1/1 Running 0 27m
kube-system kube-apiserver-master 1/1 Running 0 27m
kube-system kube-controller-manager-master 1/1 Running 0 27m
kube-system kube-proxy-5x74j 1/1 Running 0 27m
kube-system kube-proxy-fjwv6 1/1 Running 0 2m11s
kube-system kube-scheduler-master 1/1 Running 0 27m

View the kuberctl.services log

[root@master ~]# journalctl -f -u kubelet.service
-- Logs begin at Mon 2023-04-03 09:15:16 UTC. --
Apr 03 09:51:07 master kubelet[12129]: E0403 09:51:07.926060 12129 kubelet.go:2475] "Container runtime network not ready" networkReady="NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized"

Reason: Missing network plug-in, deploy flannel network plug-in

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

If not, you can try calico

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

kubectl apply -f calico.yaml

If the calico above does not work then go to the link https://github.com/projectcalico/calico/blob/master/manifests/calico.yaml and paste a new calico

Check the pod status again and you can see that the status is normal.

Check status - normal

Reference link: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#pod-network