k8s 集群之间clusterIp+port互不相同问题、flannel节点之间无法通信解决办法
问题原因1,pod-network-cidr 与默认(10.244.0.0/16)配置不同
修改官方部署flannel的yaml文件中
{
"Network": "10.244.0.0/16", # 改成你部署集群是的 --pod-network-cidr
"Backend": {
"Type": "vxlan"
}
}
问题原因2,用虚拟机安装,mac地址重复导致
检查问题
$ kubectl get node -o yaml | grep -A3 Vtep
flannel.alpha.coreos.com/backend-data: '{"VtepMAC":"fe:22:77:eb:2f:a4"}'
flannel.alpha.coreos.com/backend-type: vxlan
flannel.alpha.coreos.com/kube-subnet-manager: "true"
flannel.alpha.coreos.com/public-ip: 172.18.27.252
--
flannel.alpha.coreos.com/backend-data: '{"VtepMAC":"fe:22:77:eb:2f:a4"}'
flannel.alpha.coreos.com/backend-type: vxlan
flannel.alpha.coreos.com/kube-subnet-manager: "true"
flannel.alpha.coreos.com/public-ip: 172.18.27.253
--
flannel.alpha.coreos.com/backend-data: '{"VtepMAC":"fe:22:77:eb:2f:a4"}'
flannel.alpha.coreos.com/backend-type: vxlan
flannel.alpha.coreos.com/kube-subnet-manager: "true"
flannel.alpha.coreos.com/public-ip: 172.18.27.254
分别在所有节点创建10-flannel.1.link
文件
cat<<'EOF'>/etc/systemd/network/10-flannel.1.link
[Match]
OriginalName=flannel.1
[Link]
MACAddressPolicy=none
EOF
删除 flannel.1
ip link delete flannel.1
删除集群中所有kube-flannel-ds
pod,之后pod自动重建时,flannel.1会被重建
kubectl delete pod kube-flannel-ds-*** -n kube-system
kube-flannel-ds-*** 换成你集群中的具体名称
测试是否可以互通
本文来自博客园,作者:gui.h,转载请注明原文链接:https://www.cnblogs.com/springhgui/p/15797765.html