Error from server: Get https://xx:10250/containerLogs dial tcp 10250: connect: no route to host
程序员文章站
2022-06-07 22:41:39
...
重启虚拟机之后。发现之前运行的nginx访问不到,使用logs命令来查询k8s中pod日志提示以下错误:
Error from server: Get https://192.168.180.129:10250/containerLogs/qsm-namespace/proxy-nginx-6bc7c74544-czln8/nginx: dial tcp 192.168.180.129:10250: connect: no route to host
提示connect: no route to host意思就是无法取得连接,所以解决思路为:
1、ping
[[email protected] ~]# ping node1
PING node1 (192.168.180.131) 56(84) bytes of data.
64 bytes from node1 (192.168.180.131): icmp_seq=1 ttl=64 time=0.526 ms
64 bytes from node1 (192.168.180.131): icmp_seq=2 ttl=64 time=0.623 ms
这就代表node1(192.168.180.131)子节点ip是可以ping同的。
2、telnet
telnet 192.168.180.131 10250
端口是连接不上的。代表是端口没有开。
3、firewall
去node1和node2查看防火墙状态,发现竟然是开启状态的。
[[email protected] ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2020-07-18 21:43:58 EDT; 31min ago
Docs: man:firewalld(1)
Main PID: 5731 (firewalld)
Tasks: 2
Memory: 30.6M
CGroup: /system.slice/firewalld.service
└─5731 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
这就有点意思了,因为之前 一步安装k8s集群——5分钟在CentOS安装k8s集群——非常简单一看就会 安装k8s教程的时候是关闭了防火墙的。再去看教程的时候使用的是stop,而stop仅仅是暂时关闭,还需要使用disable。
[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# systemctl disable firewalld
【暂完】
正在去BAT的路上修行