问题:k8s安装,节点一直处于NotReady状态,通过执行命令查看日志
2月 21 15:10:17 node1 kubelet[29536]: : [failed to find plugin "flannel" in path [/opt/cni/bin]]
2月 21 15:10:17 node1 kubelet[29536]: W0221 15:10:17.522430 29536 cni.go:237] Unable to update cni config: no valid networks found in /etc/cni/net.d
2月 21 15:10:18 node1 kubelet[29536]: E0221 15:10:18.390821 29536 kubelet.go:2183] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
# 查看节点状态
kubectl get nodes
# 查看日志
journalctl -f -u kubelet.service
日志:
[failed to find plugin "flannel" in path [/opt/cni/bin]]
排查:
进入指定目录查看,是否有flannel
cd /opt/cni/bin
解决:
如果缺少flannel,则需要下载CNI插件:CNI plugins v0.8.6
下载地址:
地址一:Release CNI plugins v0.8.6 · containernetworking/plugins · GitHub
(访问慢可使用地址二进行下载)
地址二:https://download.csdn.net/download/qq_19690417/88859465
下载后上传至服务器任意目录并解压
tar zxvf cni-plugins-linux-amd64-v0.8.6.tgz
解压后将flannel文件复制到/opt/cni/bin/即可
cp flannel /opt/cni/bin/
然后再执行【kubectl get nodes】查看节点状态