Error registering network: failed to acquire lease
k8s
flannel插件安装失败:
项目场景:
使用kubeadm搭建k8s集群
环境:CentOS7.9
问题描述
部署flannel网络插件失败:
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-flannel kube-flannel-ds-55nbz 0/1 CrashLoopBackOff 3 2m48s
原因分析:
查看pod日志:kubectl get pod -n kube-flannel kube-flannel-ds-55nbz
E0825 09:00:25.015344 1 main.go:330] Error registering network: failed to acquire lease: subnet "10.244.0.0/16" specified in the flannel net config doesn't contain "172.16.0.0/24" PodCIDR of the "master" node.
W0825 09:00:25.018642 1 reflector.go:436] github.com/flannel-io/flannel/subnet/kube/kube.go:403: watch of *v1.Node ended with: an error on the server ("unable to decode an event from the watch stream: context canceled") has prevented the request from succeeding
I0825 09:00:25.018698 1 main.go:447] Stopping shutdownHandler...
原因:初始化master节点时,指定了–pod-network-cidr=172.16.0.0/16
那么,kube-flannel.yml中该部分网段也要进行对应,默认是“10.244.0.0/16”
解决方案:
方案一:重新初始化,设置pod的网段 10.244.0.0/16 推荐使用这种
方案二:修改kube-flannel.yaml 添加网段
vi kube-flannel.yml
net-conf.json: |
{
"Network": "172.16.0.0/16",
"Backend": {
"Type": "vxlan"
}
}
kubectl apply -f kube-flannel.yml
再对pod进行观察
watch -n1 kubectl get pods -A
文章知识点与官方知识档案匹配,可进一步学习
————————————————
版权声明:本文为CSDN博主「leec。」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_51432770/article/details/126528760
更多推荐
所有评论(0)