calico使用哪个网卡的ip,有它自己的发现策略机制,参见官方文档:
https://docs.projectcalico.org/reference/node/configuration#ip-autodetection-methods

这导致在多网卡(多ip)主机上,他的默认发现规则first-found可能并不是你想要的,导致的结果就是不通主机间pod ping不通。在主机上能ping通本机上的pod的ip。
可以进到calico pod中
kubectl get po -n kube-system |grep calico
使用如下命令,查看当前网络的状态
birdcl -s /var/run/calico/bird.ctl show protocols

如果有非Established的状态,可以从这里入手排查。

那么我们可以通过指定使用哪个网卡来规避这个问题

kubectl set env daemonset/calico-node -n kube-system IP_AUTODETECTION_METHOD=interface=eth0

参考:
https://docs.projectcalico.org/networking/ip-autodetection#change-the-autodetection-method

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐