解决了跨node的pod连通性,接下来面临新问题,首先是nodeport只对pod所在node能够访问。

http://dockone.io/question/1504

参考上面链接,执行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转发没有开。

[root@hadoop001 ~]# 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可以外部访问。

 

 

 

 

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐