错误描述:
"Container runtime network not ready" networkReady="NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized"
解决方案:
下载flannel镜像(最新版本)
[root@k8s-node1 ~]# docker pull jmgao1983/flannel
[root@k8s-master~]# mkdir -p /etc/cni/net.d/ [root@k8s-master~]# cat <<EOF> /etc/cni/net.d/10-flannel.conf > {"name":"cbr0","type":"flannel","delegate": {"isDefaultGateway": true}} > EOF [root@k8s-master~]# mkdir /usr/share/oci-umount/oci-umount.d -p [root@k8s-master~]# mkdir /run/flannel/ mkdir: 无法创建目录"/run/flannel/": 文件已存在 [root@k8s-master~]# cat <<EOF> /run/flannel/subnet.env > FLANNEL_NETWORK=192.168.0.0/16 > FLANNEL_SUBNET=192.168.1.0/24 > FLANNEL_MTU=1450 > FLANNEL_IPMASQ=true > EOF [root@k8s-master~]# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml Warning: policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ podsecuritypolicy.policy/psp.flannel.unprivileged configured clusterrole.rbac.authorization.k8s.io/flannel unchanged clusterrolebinding.rbac.authorization.k8s.io/flannel unchanged serviceaccount/flannel unchanged configmap/kube-flannel-cfg unchanged daemonset.apps/kube-flannel-ds unchanged [root@k8s-master~]# systemctl restart kubelet [root@k8s-master ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION k8s-master Ready control-plane,master 3h54m v1.23.5 k8s-node1 Ready <none> 3h46m v1.23.5
问题解决~