1.问题描述
pod状态
default nfs-client-provisioner-5c4c7d9fb8-99r4j 1/1 Running 0 20h
kube-system calico-kube-controllers-6fd7b9848d-smrz6 0/1 ContainerCreating 0 10s
kube-system calico-node-pwqgj 0/1 Running 0 10s
kube-system calico-node-t59lb 0/1 Running 0 10s
kube-system calico-node-zbjsw 0/1 Running 0 10s
kube-system coredns-558bd4d5db-jgdx2 1/1 Running 0 21h
# 查看问题
kubectl describe pod calico-node-h5cwb -n kube-system
日志如下:
d.ctl: connect: connection refused
Warning Unhealthy 3m51s kubelet Readiness probe failed: 2022-04-04 12:57:54.671 [INFO][240] 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 10.167.0.6,10.163.0.58
Warning Unhealthy 3m41s kubelet Readiness probe failed: 2022-04-04 12:58:04.681 [INFO][280] 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 10.167.0.6,10.163.0.58
Warning Unhealthy 3m31s kubelet Readiness probe failed: 2022-04-04 12:58:14.675 [INFO][329] 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 10.167.0.6,10.163.0.58
Warning Unhealthy 3m21s kubelet Readiness probe failed: 2022-04-04 12:58:24.720 [INFO][388] 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 10.167.0.6,10.163.0.58
Warning Unhealthy 3m11s kubelet Readiness probe failed: 2022-04-04 12:58:34.678 [INFO][414] 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 10.167.0.6,10.163.0.58
Warning Unhealthy 3m1s kubelet Readiness probe failed: 2022-04-04 12:58:44.709 [INFO][467] 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 10.167.0.6,10.163.0.58
Warning Unhealthy 2m51s kubelet Readiness probe failed: 2022-04-04 12:58:54.702 [INFO][511] 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 10.167.0.6,10.163.0.58
Warning Unhealthy 2m41s kubelet Readiness probe failed: 2022-04-04 12:59:04.713 [INFO][556] 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 10.167.0.6,10.163.0.58
Warning Unhealthy 2m1s (x4 over 2m31s) kubelet (combined from similar events): Readiness probe failed: 2022-04-04 12:59:44.726 [INFO][718] 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 10.167.0.6,10.163.0.58
2.解决方法
step 1
修改网络插件vim calico.yaml
搜索 autodetect
- name: IP
value: "autodetect"
在其后面添加如下行
# 在其后面添加如下行
- name: IP_AUTODETECTION_METHOD
value: "interface=ens*"
修改之后样式
# 修改之后样式
# Auto-detect the BGP IP address.
- name: IP
value: "autodetect"
- name: IP_AUTODETECTION_METHOD
value: "interface=ens*"
step 2
搜索 v1beta1 , 移除beta1 , 调整如下
修改前
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
修改后
apiVersion: policy/v1
kind: PodDisruptionBudget
应用
kubectl apply -f calico.yaml
运行结果
NAMESPACE NAME READY STATUS RESTARTS AGE
default nfs-client-provisioner-5c4c7d9fb8-99r4j 1/1 Running 0 20h
kube-system calico-kube-controllers-6fd7b9848d-smrz6 1/1 Running 0 15s
kube-system calico-node-pwqgj 1/1 Running 0 15s
kube-system calico-node-t59lb 1/1 Running 0 15s
kube-system calico-node-zbjsw 1/1 Running 0 15s
3.解释
- 因为calico默认是检测
Ethernet网卡,如果服务器是ens, 需要修改一下检测正则表达式,以致于能够找到正确的ip. - v1beta1 修改为 v1, 意味着升级为v1版本, 不会抛出WARNNING。
版权声明:本文为qq_39698985原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。