您好,登錄后才能下訂單哦!
Kubernetes node的防火墻問題導(dǎo)致pod ip無法訪問該怎么辦,相信很多沒有經(jīng)驗(yàn)的人對(duì)此束手無策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個(gè)問題。
環(huán)境:
1.在hadoop36機(jī)器,ping hadoop38機(jī)器的pod的ip,為172.30.1.4
2.該pod的service的external-ip的ip為hadoop36的ip
3.下面機(jī)器的ip,已經(jīng)使用 xx.xx.xx.來替代和加圖層覆蓋掉
問題: 無法通過服務(wù)EXTERNAL-IP+port,訪問對(duì)應(yīng)的pod的服務(wù),說白了,就是無法訪問pod ip+port,無法ping通172.30.1.4
步驟:
1.先把服務(wù)停掉
[root@hadoop38 ~]# systemctl stop etcd flanneld docker kubelet kube-proxy
2.查看當(dāng)前規(guī)則,然后清空
[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 和 開啟服務(wù)
[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.等待一會(huì) 最終查看防火墻策略
[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機(jī)器驗(yàn)證ping 和 telnet檢驗(yàn)
[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.這種情況發(fā)生過兩次(都是因?yàn)関m機(jī)器重啟),特此記錄一下步驟,備查。
看完上述內(nèi)容,你們掌握Kubernetes node的防火墻問題導(dǎo)致pod ip無法訪問該怎么辦的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注億速云行業(yè)資訊頻道,感謝各位的閱讀!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。