使用tigera-operator方式安装的calico,启动后报错,所有的calico相关的pod都显示CrashLoopBackoff。

kubectl -n calico-system describe pod calico-node-2t8w6,发现如下报错:

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: no such file or directory.

问题原因:

我们是在 Kubernetes Cluster 部署过程中遇到该问题。由于 Calico 自动检测 IP 地址默认使用 first-found 方法,获得错误地址,需要我们手动指定检测方法。

1、将所有claico删除

kubectl -n tigera-operator get deployments.apps -o yaml > a.yaml
kubectl -n calico-system get daemonsets.apps calico-node -o yaml > b.yaml
kubectl -n calico-system get deployments.apps calico-kube-controllers -o yaml > c.yaml
kubectl -n calico-system get deployments.apps calico-typha -o yaml > d.yaml
kubectl -n calico-apiserver get deployments.apps calico-apiserver -o yaml > e.yaml
kubectl delete -f a.yaml
kubectl delete -f b.yaml
kubectl delete -f c.yaml
kubectl delete -f d.yaml
kubectl delete -f e.yaml

2、删除custom-resources.yaml

kubectl delete -f tigera-operator.yaml

kubectl delete -f custom-resources.yaml

3、删除vxlan.calico

ip link delete vxlan.calico

4、修改custom-resources.yaml文件,添加 nodeAddressAutodetectionV4:
 

# This section includes base Calico installation configuration.
# For more information, see: https://projectcalico.docs.tigera.io/v3.23/reference/installation/api#operator.tigera.io/v1.Installation
apiVersion: operator.tigera.io/v1
kind: Installation
metadata:
  name: default
spec:
  # Configures Calico networking.
  calicoNetwork:
    # Note: The ipPools section cannot be modified post-install.
    #bgp: Enabled
    #hostPorts: Enabled
    ipPools:
    - blockSize: 26
      cidr: 10.244.0.0/16
      encapsulation: VXLANCrossSubnet
      natOutgoing: Enabled
      nodeSelector: all()
    #linuxDataplane: Iptables
    #multiInterfaceMode: None
    nodeAddressAutodetectionV4:
      interface: ens.*

---

# This section configures the Calico API server.
# For more information, see: https://projectcalico.docs.tigera.io/v3.23/reference/installation/api#operator.tigera.io/v1.APIServer
apiVersion: operator.tigera.io/v1
kind: APIServer
metadata:
  name: default
spec: {}
 

5、重新创建

kubectl create -f tigera-operator.yaml

kubectl create -f custom-resources.yaml
 

检查

kubectl -n calico-system get daemonsets.apps calico-node  -o yaml|grep -A2 IP_AUTODETECTION_METHOD

参考网址

calico/node is not ready: BIRD is not ready: Error querying BIRD: unable to connect to BIRDv4 socket: dial unix /var/run/bird/bird.ctl: connect: no such file or directory · Issue #2834 · projectcalico/calico · GitHub

ubuntu20.04下k8s集群及网络部署史上最详细文档 - 知乎

Calico无法正确识别网卡类型的问题 - 知乎

「Kubernetes」- 常见 Calico 问题 @20210422

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐