由于k8s安装master一直处于NotReady状态查看日志出现failed to find plugin “flannel” in path [/opt/cni/bin]

日志信息

1 : [failed to find plugin “flannel” in path [/opt/cni/bin]]
1 W1226 16:19:36.66813347110 cni.go:237] Unable to update cni config: no valid networks found in /etc/cni/net.d
1 E1226 16:19:36.94577847110 kubelet.go:2187] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
1 W1226 16:19:41.66998047110 cni.go:202] Error validating CNI config list {

查看 /opt/cni/bin 缺少 flannel

查看节点状态

kubectl get nodes

查看日志命令

journalctl -u kubelet -f

解决方案

需要下载CNI插件:CNI plugins v0.8.6

github下载地址:https://github.com/containernetworking/plugins/releases/tag/v0.8.6

(在1.0.0版本后CNI Plugins中没有flannel)

下载后通过xftp 上传到Linux /home目录解压

tar zxvf cni-plugins-linux-amd64-v0.8.6.tgz

复制 flannel 到 /opt/cni/bin/

[root@k8s-node1 home]# cp flannel /opt/cni/bin/

查看节点状态

查看到状态立马变为Ready,至此解决问题。