Kubernetes 常见 Calico 问题 | 详细教程

永久地址:Kubernetes 常见 Calico 问题 | 详细教程(保存网址不迷路 )

 

问题描述

该笔记将记录:在 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                        
calico-node-p6g6x                          0/1     Running   0          25s     172.16.159.15     cita-cloud-staging              
...

# 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」- etcd-k8scp-01
「Kubernetes」- kube-controller-manager-k8scp-01
「Kubernetes」- kube-scheduler-k8scp-01

参考文献

About Calico
About Kubernetes Networking

你可能感兴趣的:(Kubernetes 常见 Calico 问题 | 详细教程)