解决k8s的nodePort,外网不能访问

 

 

官方原文:
Disabling SELinux by running setenforce 0 is required to allow containers to access the host filesystem, which is required by pod networks for example. You have to do this until SELinux support is improved in the kubelet.
翻译就是
通过setenforce 0 关闭SELinux是必须的,这样容器才可以访问主机的文件系统,例如pod的网络操作就需要访问主机文件系统。直到kubelet支持SELinux之前你都需要关闭SELinux。

iptables --flushiptables -tnat --flush是清空iptables的规则,然后重启docker后会重新加入kubernetes的iptables规则,iptables -P FORWARD ACCEPT则允许转发

iptables --flush&iptables -tnat --flush & iptables -P FORWARD ACCEPT

 



iptables --flush&iptables -tnat --flush & iptables -P FORWARD ACCEPT

 


iptables -P FORWARD ACCEPT

posted @ 2021-01-21 11:40  滴滴滴  阅读(4856)  评论(0编辑  收藏  举报