kubernetes nodePort不可訪問問題

通常由于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 --flushiptables -tnat --flush是清空iptables的規則,然后重啟docker后會重新加入kubernetes的iptables規則,iptables -P FORWARD ACCEPT則允許轉發

?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容