记一次k8s的pod间网络无法访问解决
k8s的pod网络访问问题解决
·
1、故障现象
只要是k8s创建的pod,网络都无法访问。
查看pod
2、查看日志
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 3m8s default-scheduler Successfully assigned kube-system/calico-node-t7sst to ty-elasticsearch.novalocal
Normal Pulling 3m8s kubelet Pulling image "docker.io/calico/cni:v3.24.1"
Normal Pulled 2m13s kubelet Successfully pulled image "docker.io/calico/cni:v3.24.1" in 55.314389804s
Normal Created 2m12s kubelet Created container upgrade-ipam
Normal Started 2m12s kubelet Started container upgrade-ipam
Normal Pulled 2m12s kubelet Container image "docker.io/calico/cni:v3.24.1" already present on machine
Normal Created 2m12s kubelet Created container install-cni
Normal Started 2m12s kubelet Started container install-cni
Normal Pulling 2m11s kubelet Pulling image "docker.io/calico/node:v3.24.1"
Normal Started 94s kubelet Started container calico-node
Normal Created 94s kubelet Created container mount-bpffs
Normal Started 94s kubelet Started container mount-bpffs
Normal Pulled 94s kubelet Successfully pulled image "docker.io/calico/node:v3.24.1" in 36.92760651s
Normal Created 94s kubelet Created container calico-node
Normal Pulled 94s kubelet Container image "docker.io/calico/node:v3.24.1" already present on machine
Warning Unhealthy 93s 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/bird/bird.ctl: connect: no such file or directory
Warning Unhealthy 92s 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 88s kubelet Readiness probe failed: 2022-09-05 07:27:00.089 [INFO][250] 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.18.133,172.21.18.216
Warning Unhealthy 78s kubelet Readiness probe failed: 2022-09-05 07:27:10.093 [INFO][275] 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.18.133,172.21.18.216
3、解决方式
先卸载原有的calico
kubectl delete -f calico.yaml
重新下载calico.yaml
wget https://docs.projectcalico.org/manifests/calico.yaml --no-check-certificate
修改calico.yaml
vim calico.yaml
#1、找到如下命令,增加
- name: CALICO_NETWORKING_BACKEND
valueFrom:
configMapKeyRef:
name: calico-config
key: calico_backend
# 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、更改为配置的CIDR地址:
# - name: CALICO_IPV4POOL_CIDR
# value: "192.168.0.0/16"
- name: CALICO_IPV4POOL_CIDR
value: "10.244.0.0/16"
部署calico
kubectl apply -f calico.yaml
kubectl get pod -A
更多推荐
已为社区贡献2条内容
所有评论(0)