【问题标题】:Kubernetes NodePort - Ufw/Iptables ignored?Kubernetes NodePort - 忽略 Ufw/Iptables?
【发布时间】:2018-11-03 08:57:57
【问题描述】:

我在一台机器上打开了一个 Kubernetes NodePort,并使用以下规则阻止了到该端口的所有流量:

sudo ufw deny 30001

但我仍然可以通过浏览器访问该端口。这很常见吗?我在文档中找不到任何相关信息。

【问题讨论】:

  • 拒绝什么方向?入口还是出口?
  • 试试ufw deny proto tcp to any port 30001
  • 还要确保您正在从浏览器访问的节点上运行该拒绝命令
  • 它的入口。我在上面尝试了您的命令,但也没有任何更改。我还检查了拒绝正确的主机,没有变化。

标签: kubernetes iptables kubernetes-ingress ufw


【解决方案1】:

终于找到了问题:kube-proxy 正在编写 iptables 规则 (https://kubernetes.io/docs/tasks/debug-application-cluster/debug-service/#is-kube-proxy-writing-iptables-rules),这些规则在手动添加的 ufw 规则之一之前被捕获。这可以通过检查iptables -S -v 的输出中的顺序来确认。

【讨论】:

  • 我相信 nodeport 是可用的,但是由于服务通过 iptable 规则访问 Pod,您应该无法自己访问 Pod
猜你喜欢
  • 2014-05-01
  • 1970-01-01
  • 2013-04-09
  • 2019-11-15
  • 2020-11-17
  • 2020-07-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多