成都创新互联网站制作重庆分公司

Kubernetesnode的防火墙问题导致podip无法访问该怎么办

Kubernetes node的防火墙问题导致pod ip无法访问该怎么办,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。

10多年的高安网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。网络营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整高安建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联从事“高安网站设计”,“高安网站推广”以来,每个客户项目都认真落实执行。

环境:
1.在hadoop36机器,ping hadoop38机器的pod的ip,为172.30.1.4
2.该pod的service的external-ip的ip为hadoop36的ip
3.下面机器的ip,已经使用 xx.xx.xx.来替代和加图层覆盖掉

问题:
 无法通过服务EXTERNAL-IP+port,访问对应的pod的服务,说白了,就是无法访问pod ip+port,无法ping通172.30.1.4
Kubernetes node的防火墙问题导致pod ip无法访问该怎么办


步骤:
1.先把服务停掉
[root@hadoop38 ~]#  systemctl stop etcd flanneld docker kubelet kube-proxy

2.查看当前规则,然后清空
[root@hadoop38 ~]#  iptables -L -n

[root@hadoop38 ~]#  iptables -F &&  iptables -X &&  iptables -F -t nat &&  iptables -X -t nat
[root@hadoop38 ~]#  iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
[root@hadoop38 ~]# 


3.重启iptables 和 开启服务
[root@hadoop38 ~]#  systemctl restart iptables
[root@hadoop38 ~]#  systemctl start etcd flanneld docker kubelet kube-proxy

4.再次查看防火墙策略 和清空掉
[root@hadoop38 ~]#  iptables -L -n
[root@hadoop38 ~]#  iptables -F &&  iptables -X &&  iptables -F -t nat &&  iptables -X -t nat

5.等待一会 最终查看防火墙策略 
[root@hadoop38 ~]#  iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
KUBE-FIREWALL  all  --  0.0.0.0/0            0.0.0.0/0           

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
KUBE-FIREWALL  all  --  0.0.0.0/0            0.0.0.0/0           
KUBE-SERVICES  all  --  0.0.0.0/0            0.0.0.0/0            /* kubernetes service portals */


Chain KUBE-FIREWALL (2 references)
target     prot opt source               destination         
DROP       all  --  0.0.0.0/0            0.0.0.0/0            /* kubernetes firewall for dropping marked packets */ mark match 0x8000/0x8000


Chain KUBE-SERVICES (1 references)
target     prot opt source               destination         
[root@hadoop38 ~]#          destination   


6.在36机器验证ping 和 telnet检验
[root@hadoop36 DNS]#  kubectl get all -n cdh -o wide
NAME                    READY     STATUS    RESTARTS   AGE       IP           NODE
po/MySQL-master-64k8r   1/1       Running   5          1h        172.30.1.4   xx.xx.xx.38

NAME              DESIRED   CURRENT   READY     AGE       CONTAINER(S)   IMAGE(S)                                                SELECTOR
rc/mysql-master   1         1         1         1h        master         hadoop35.jiuye/k8sregister/jiuye/mysql5.6-master:v1.6   name=mysql-master

NAME               CLUSTER-IP      EXTERNAL-IP     PORT(S)     AGE       SELECTOR
svc/mysql-master   10.254.56.245    xx.xx.xx.36   13307/TCP   1h        name=mysql-master
[root@hadoop36 dns]# 

[root@hadoop36 dns]# ping 172.30.1.4
PING 172.30.1.4 (172.30.1.4) 56(84) bytes of data.
64 bytes from 172.30.1.4: icmp_seq=1 ttl=63 time=0.388 ms
^Z
[31]+  Stopped                 ping 172.30.1.4

[root@hadoop36 dns]# telnet   xx.xx.xx.36 13307
Trying  xx.xx.xx..36...
Connected to  xx.xx.xx..36.
Escape character is '^]'


备注:
1.这种情况发生过两次(都是因为vm机器重启),特此记录一下步骤,备查。

看完上述内容,你们掌握Kubernetes node的防火墙问题导致pod ip无法访问该怎么办的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注创新互联行业资讯频道,感谢各位的阅读!


当前标题:Kubernetesnode的防火墙问题导致podip无法访问该怎么办
文章网址:http://cxhlcq.com/article/jojjci.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部