1. 程式人生 > >k8s calico網路排錯2

k8s calico網路排錯2

解決了跨node的pod連通性,接下來面臨新問題,首先是nodeport只對pod所在node能夠訪問。

參考上面連結,執行sudo iptables -P FORWARD ACCEPT初步解決該問題,hadoop001的還是不行

報錯如下:

Chain KUBE-SERVICES (2 references)

target prot opt source destination

REJECT tcp -- anywhere anywhere /* pezy/hbase-hmaster:master-web has no endpoints */ ADDRTYPE match dst-type LOCAL tcp dpt:32098 reject-with icmp-port-unreachable

REJECT tcp -- anywhere 10.96.7.193 /* pezy/hbase-hmaster:master-web has no endpoints */ tcp dpt:60010 reject-with icmp-port-unreachable

REJECT tcp -- anywhere anywhere /* pezy/yarn-resourcemanager:web has no endpoints */ ADDRTYPE match dst-type LOCAL tcp dpt:30880 reject-with icmp-port-unreachable

REJECT tcp -- anywhere 10.97.228.2 /* pezy/yarn-resourcemanager:web has no endpoints */ tcp dpt:23188 reject-with icmp-port-unreachable

REJECT tcp -- anywhere anywhere /* pezy/yarn-resourcemanager:jobhistory-web has no endpoints */ ADDRTYPE match dst-type LOCAL tcp dpt:31879 reject-with icmp-port-unreachable

後發現hadoop001的docker映象,外部無法訪問,包括私有倉庫,重啟倉庫。

發現ip轉發沒有開。

[[email protected] ~]# docker run -d -p 5000:5000 -v /dlw_registry:/var/lib/registry registry:2.6.0

WARNING: IPv4 forwarding is disabled. Networking will not work.

c1e2695253639540d02f8bc4cbfc586d2a75b679b5275a6387e7aa5b45787d1f

解決辦法:

# vi /etc/sysctl.conf

或者

# vi /usr/lib/sysctl.d/00-system.conf

新增如下程式碼:

    net.ipv4.ip_forward=1

重啟network服務

# systemctl restart network

檢視是否修改成功

# sysctl net.ipv4.ip_forward

如果返回為“net.ipv4.ip_forward = 1”則表示成功了

修改後,倉庫可以訪問,docker可以外部訪問。