calico-node显示running但not ready
时间:
2021-06-19 09:28:14
阅读:
18
评论:
收藏:
0
[点我收藏+]
1、故障现象:
kubenetes安装calico发现其中一个处于Running,但READY列却显示不正常,状态如下图所示:

2、寻找原因
进入到出现故障 pod,查看router id值发现绑定地址异常,并非宿主机的IP地址
```
[root@master01 ~]# kubectl exec -ti calico-node-j4f5m -n kube-system -- bash
[root@k8s-master1 /]# cat /etc/calico/confd/config/bird.cfg
```

3、解决方法
(1)、calico.yaml 文件添加以下两行,网卡使用ifconfig查看宿主机的网卡名称,我的宿主机的网卡名称是 ens33
```
[root@master01 ~]# ifconfig
docker0: flags=4099 mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:7d:18:01:ae txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens33: flags=4163 mtu 1500
inet 192.168.31.73 netmask 255.255.255.0 broadcast 192.168.31.255
inet6 fe80::c8f3:b547:a509:d990 prefixlen 64 scopeid 0x20
ether 00:0c:29:d8:0c:67 txqueuelen 1000 (Ethernet)
RX packets 4740537 bytes 1428558903 (1.3 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4178151 bytes 627478129 (598.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
```
这里直接配置通配符 :value: "interface=ens.*"
```
[root@master01 ~]# vi calico.yaml
# Cluster type to identify the deployment type
- name: CLUSTER_TYPE
value: "k8s,bgp"
#新增两行配置
- name: IP_AUTODETECTION_METHOD
value: "interface=ens.*"
# Auto-detect the BGP IP address.
- name: IP
value: "autodetect"
# Enable IPIP
- name: CALICO_IPV4POOL_IPIP
value: "Always"
```
(2)、重新应用
```
[root@master01 ~]# rm -rf /var/lib/cni
[root@master01 ~]# kubectl apply -f calico.yaml
[root@master01 ~]# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
calico-kube-controllers-97769f7c7-8jzg7 1/1 Running 0 72m
calico-node-qfwsp 1/1 Running 0 104s
calico-node-qtn9z 1/1 Running 0 2m3s
calico-node-xdswl 1/1 Running 0 2m22s
```
4、问题解决calico-node显示running但not ready
原文:https://blog.51cto.com/u_8355320/2926996