新的node加入集群后,在启动calico的时候,状态处于running ready:0/1
通过describe pod 查看事件,报错:
Warning Unhealthy 5m23s kubelet Readiness probe failed: 2020-12-09 05:51:37.828 [INFO][206] confd/health.go 180: Number of node(s) with BGP peering established = 0
calico/node is not ready: BIRD is not ready: BGP not established with 172.19.0.1
Warning Unhealthy 5m13s kubelet Readiness probe failed: 2020-12-09 05:51:47.842 [INFO][270] confd/health.go 180: Number of node(s) with BGP peering established = 0
calico/node is not ready: BIRD is not ready: BGP not established with 172.19.0.1
调整calicao 网络插件的网卡发现机制,修改IP_AUTODETECTION_METHOD对应的value值。官方提供的yaml文件中,ip识别策略(IPDETECTMETHOD)没有配置,即默认为first-found,这会导致一个网络异常的ip作为nodeIP被注册,从而影响node-to-node mesh。我们可以修改成can-reach或者interface的策略,尝试连接某一个Ready的node的IP,以此选择出正确的IP。
解决:
calico.yaml 文件添加以下二行
- name: IP_AUTODETECTION_METHOD
value: "interface=em.*" # em.*正则表示匹配到em开头的所有网卡
配置如下
- name: CLUSTER_TYPE
value: "k8s,bgp"
- name: IP_AUTODETECTION_METHOD
value: "interface=em.*" #或者 value: "interface=em3"
- name: IP
value: "autodetect"