今天在原有的k8s集群上新增一个节点,在使用kubeadm join命令增加node节点成功以后,等了5分钟,在master上查看新加节点状态一直是notready状态,然后进行排查
在node节点上执行命令查看kubelet日志
journalctl -f -u kubelet
日志如下:
Mar 09 13:52:46 k8s-cpu-node2 kubelet[12975]: E0309 13:52:46.191060 12975 kubelet.go:2347] "Container runtime network not ready" networkReady="NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized" Mar 09 13:52:48 k8s-cpu-node2 kubelet[12975]: I0309 13:52:48.004966 12975 cni.go:240] "Unable to update cni config" err="no networks found in /etc/cni/net.d" Mar 09 13:52:51 k8s-cpu-node2 kubelet[12975]: E0309 13:52:51.210913 12975 kubelet.go:2347] "Container runtime network not ready" networkReady="NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized" Mar 09 13:52:53 k8s-cpu-node2 kubelet[12975]: I0309 13:52:53.006202 12975 cni.go:240] "Unable to update cni config" err="no networks found in /etc/cni/net.d" Mar 09 13:52:56 k8s-cpu-node2 kubelet[12975]: E0309 13:52:56.229009 12975 kubelet.go:2347] "Container runtime network not ready" networkReady="NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized" Mar 09 13:52:58 k8s-cpu-node2 kubelet[12975]: I0309 13:52:58.007075 12975 cni.go:240] "Unable to update cni config" err="no networks found in /etc/cni/net.d"
看起来是网络cni插件有点问题,不能找到/etc/cni/net.d目录,然后去其它节点查看却有这个目录,然后试着将master节点的这个目录复制过来试试
scp -r k8s-cpu-master:/etc/cni /etc/cni
接着重启kubelet
systemctl restart kubelet
然后再等待3分钟左右,node节点就正常的ready状态了