「Kubernetes」- 常見 Calico 問題 @20210422


問題描述

該筆記將記錄:在 Kubernetes Cluster 中,與 Calico 有關的常用設置,以及相關問題處理。

解決方案

calico/node is not ready: BIRD is not ready: BGP not established with 172.21.0.1

Calico readiness and liveliness probe fails · Issue #2042 · projectcalico/calico
Configuring calico/node

問題描述

在集群中的 calico-node 處於 Ready 0/1 狀態,並且 Events 顯示 calico/node is not ready: BIRD is not ready: BGP not established with 172.21.0.1 消息:

# kubectl get pods -n kube-system -o wide
...
calico-node-77gbb                          0/1     Running   0          25s     172.16.187.21     k8scp-01             <none>           <none>
calico-node-p6g6x                          0/1     Running   0          25s     172.16.159.15     cita-cloud-staging   <none>           <none>
...

# kubectl describe pods -n kube-system calico-node-77gbb
...
  Normal   Started    102s  kubelet            Started container calico-node
  Normal   Pulled     102s  kubelet            Container image "docker.io/calico/node:v3.18.1" already present on machine
  Normal   Created    102s  kubelet            Created container calico-node
  Warning  Unhealthy  100s  kubelet            Readiness probe failed: calico/node is not ready: BIRD is not ready: Error querying BIRD: unable to connect to BIRDv4 socket: dial unix /var/
run/calico/bird.ctl: connect: connection refused
  Warning  Unhealthy  90s   kubelet            Readiness probe failed: 2021-04-21 07:18:58.819 [INFO][194] 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.21.0.1
  Warning  Unhealthy  80s  kubelet  Readiness probe failed: 2021-04-21 07:19:08.821 [INFO][224] 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.21.0.1
  Warning  Unhealthy  70s  kubelet  Readiness probe failed: 2021-04-21 07:19:18.822 [INFO][251] 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.21.0.1
  Warning  Unhealthy  60s  kubelet  Readiness probe failed: 2021-04-21 07:19:28.824 [INFO][283] 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.21.0.1
  Warning  Unhealthy  50s  kubelet  Readiness probe failed: 2021-04-21 07:19:38.818 [INFO][306] 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.21.0.1
  Warning  Unhealthy  40s  kubelet  Readiness probe failed: 2021-04-21 07:19:48.824 [INFO][330] 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.21.0.1
  Warning  Unhealthy  30s  kubelet  Readiness probe failed: 2021-04-21 07:19:58.825 [INFO][361] 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.21.0.1
  Warning  Unhealthy  20s  kubelet  Readiness probe failed: 2021-04-21 07:20:08.816 [INFO][385] 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.21.0.1
  Warning  Unhealthy  10s  kubelet  (combined from similar events): Readiness probe failed: 2021-04-21 07:20:18.823 [INFO][408] confd/health.go 180: Number of node(s) with BGP peering esta
blished = 0
calico/node is not ready: BIRD is not ready: BGP not established with 172.21.0.1

問題原因

我們是在 Kubernetes Cluster 部署過程中遇到該問題。由於 Calico 自動檢測 IP 地址默認使用 first-found 方法,獲得錯誤地址,需要我們手動指定檢測方法。

解決方案

我們修改 calico.yaml 的 calico-node 容器,添加 IP_AUTODETECTION_METHOD 環境變量:

containers:
- name: calico-node
  image: docker.io/calico/node:v3.18.1
  ...
  env:
    # 這是需要我們添加的環境變量
    - name: IP_AUTODETECTION_METHOD
      value: "interface=eth.*"

然后,重新應用我們的修改:

kubectl apply -f calico.yaml

相關文章

「Kubernetes」- kube-scheduler-k8scp-01
「Kubernetes」- etcd-k8scp-01
「Kubernetes」- kube-controller-manager-k8scp-01

參考文獻

About Calico
About Kubernetes Networking



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM