kubectl获取node节点,集群状态检测时,master、node一直处于NotReady状态
[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
查看pod状态,发现coredns一直处于pending状态
[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
查看kuberctl.services日志
[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"
原因:缺少网络插件,部署flannel网络插件
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
如果不行,可以试试calico
curl https://docs.projectcalico.org/manifests/calico-typha.yaml -o calico.yaml
kubectl apply -f calico.yaml
如果上面的 calico 不起作用然后转到链接https://github.com/projectcalico/calico/blob/master/manifests/calico.yaml 并粘贴一个新的 calico
再次查看pod状态,可以看到状态正常
查看状态——正常
技术性分享,转载请注明出处!
欢迎互相交流,共同进步!