network plugin is not ready: cni config uninitialized


錯誤描述:

"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

  

問題解決~


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM