k8s内的pod-nginx,无法curl -I 查询版本
当master和两个node节点在虚拟机上挂起、重启、恢复上一个快照,k8s内的pod-nginx,无法curl -I 查询版本
环境:yum搭建
虚拟机:master、node1、node2
问题:
当master和两个node节点在虚拟机上挂起、重启、恢复上一个快照
master:
kubectl get all -o wide
NAME READY STATUS RESTARTS AGE IP NODE
po/nginx 1/1 Running 0 6d 172.18.49.2 192.168.1.12
curl -I 172.18.49.2
curl: (7) Failed connect to 172.18.49.2:80; 没有到主机的路由
解决方法:
1.所有节点查看下,内核转发参数是不是正常:
sysctl -a | grep net.ipv4.ip_forward
net.ipv4.ip_forward = 0
把参数改为1
sysctl net.ipv4.ip_forward=1
2.这个时候master还会无法curl -I,pod-nginx的ip,所以所以需要所有节点中查询网卡:
ifconfig
看下flannel0,哪个没ip就重启哪个节点的flanneld.service 服务,命令:
systemctl restart flanneld.service
3.在对应的node1(192.168.1.12)中重启docker服务
systemctl restart docker
成功解决:
curl -I 172.18.49.2
HTTP/1.1 200 OK
Server: nginx/1.23.1
Date: Tue, 13 Sep 2022 12:40:40 GMT
Content-Type: text/html
Content-Length: 615
Last-Modified: Tue, 19 Jul 2022 14:05:27 GMT
Connection: keep-alive
ETag: "62d6ba27-267"
Accept-Ranges: bytes
更多推荐
所有评论(0)