本文主要是介绍calico-node显示running但not ready,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1、故障现象:
kubenetes安装calico发现其中一个处于Running,但READY列却显示不正常,状态如下图所示:
![image.png](http://www.www.zyiz.net/i/li/?n=2&i=images/20210619/1624034621345549.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=)
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
```
![image.png](http://www.www.zyiz.net/i/li/?n=2&i=images/20210619/1624035329279559.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=)
3、解决方法
(1)、calico.yaml 文件添加以下两行,网卡使用ifconfig查看宿主机的网卡名称,我的宿主机的网卡名称是 ens33
```
[root@master01 ~]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> 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<UP,BROADCAST,RUNNING,MULTICAST> 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的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!