通常由于iptables问题和selinux问题
解决方式
setenforce 0
iptables --flush
iptables -tnat --flush
service docker restart
iptables -P FORWARD ACCEPT
官方原文:
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 --flush和iptables -tnat --flush是清空iptables的规则,然后重启docker后会重新加入kubernetes的iptables规则,iptables -P FORWARD ACCEPT则允许转发
本文介绍了解决Kubernetes环境中因SELinux和iptables引发的问题的方法,包括使用setenforce0临时禁用SELinux,清空iptables规则并重启Docker服务,以及设置iptables转发策略,确保容器能正常访问主机文件系统。
1481

被折叠的 条评论
为什么被折叠?



