calico异常, ``` kubectl get pod -n kube-system ``` 显示 ``` NAME READY STATUS RESTARTS AGE calico-kube-controllers-744cfdf676-4qqph 1/1 Running 0 31m calico-node-8jr59 0/1 Running 0 20s calico-node-cs79v 0/1 Running 0 20s calico-node-fkstd 0/1 Running 0 20s coredns-7f89b7bc75-6md7d 1/1 Running 0 53m coredns-7f89b7bc75-p88r5 1/1 Running 0 53m etcd-kubernetes-master 1/1 Running 0 53m kube-apiserver-kubernetes-master 1/1 Running 0 53m kube-controller-manager-kubernetes-master 1/1 Running 0 53m kube-proxy-6tfvm 1/1 Running 0 26m kube-proxy-mgqv2 1/1 Running 0 26m kube-proxy-v25vl 1/1 Running 0 53m kube-scheduler-kubernetes-master 1/1 Running 0 53m ``` 查看pod描述信息 ``` kubectl describe pod calico-node-npjjr -n kube-system ``` 显示 ``` Warning Unhealthy 72s kubelet Readiness probe failed: 2020-12-18 13:55:29.276 [INFO][120] 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.17.0.9,172.17.0.3 Warning Unhealthy 62s kubelet Readiness probe failed: 2020-12-18 13:55:39.278 [INFO][156] 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.17.0.9,172.17.0.3 Warning Unhealthy 52s kubelet Readiness probe failed: 2020-12-18 13:55:49.283 [INFO][189] 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.17.0.9,172.17.0.3 Warning Unhealthy 42s kubelet Readiness probe failed: 2020-12-18 13:55:59.279 [INFO][215] 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.17.0.9,172.17.0.3 Warning Unhealthy 32s kubelet Readiness probe failed: 2020-12-18 13:56:09.280 [INFO][249] 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.17.0.9,172.17.0.3 Warning Unhealthy 22s kubelet Readiness probe failed: 2020-12-18 13:56:19.276 [INFO][276] 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.17.0.9,172.17.0.3 Warning Unhealthy 12s kubelet Readiness probe failed: 2020-12-18 13:56:29.276 [INFO][302] 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.17.0.9,172.17.0.3 Warning Unhealthy 2s kubelet Readiness probe failed: 2020-12-18 13:56:39.272 [INFO][335] 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.17.0.9,172.17.0.3 ``` 修改calico.yaml文件 ``` /* 调整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=ens.*" # ens 根据实际网卡开头配置 // 配置如下 - name: CLUSTER_TYPE value: "k8s,bgp" - name: IP_AUTODETECTION_METHOD value: "interface=ens.*" #或者 value: "interface=ens160" # Auto-detect the BGP IP address. - name: IP value: "autodetect" # Enable IPIP - name: CALICO_IPV4POOL_IPIP value: "Always" ```