解决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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM