今天新部署了一个k8s集群,但是遇到一个奇怪的问题 。master、node结点一直处于NotReady状态;pod中coredns也启动不起来;一直找不到原因。如下图所示:
通过命令kubectl describe node node1 查到报错原因:
runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
如下图所示:
又通过命令 journalctl -f -u kubelet.service 查找原因
一直提示:failed to find plugin "flannel" in path [/opt/cni/bin]
进入到/opt/cni/bin/目录下发现没有flannel文件。
解决方法安装flannel 到/opt/cni/bin/目录下即可
去github上下载文件链接如下:文件直接拿