netfilter是按命名空间隔离的
Is netfilter isolation by namespace
我曾经认为 netfilter 在节点级别,所以 iptables 规则只针对节点,所以 istio 可能会在 initContainer 上用 pod ip 注入 iptable 规则
但是我最近在研究chaos-mesh,它打破了这一点,我尝试使用nsexec
我在节点A上创建一个demo pod并执行nsexec -n /proc/xxxxxx/ns/net -l iptables -L
,iptable规则与节点规则不同
当我尝试添加输出规则时,它运行良好,仅适用于此 pod
netfilter 是否按名称空间隔离?
is netfilter isolation by namespace?
可以be done.
...a demo pod on node A and execute nsexec -n /proc/xxxxxx/ns/net -l iptables -L, iptable rules is different from node rules
这里发生的是 nsexec
从它自己的挂载命名空间加载 iptables
并在 pod 隔离命名空间中执行它。如您所愿,pod 获得了不同的 iptables 规则。
我曾经认为 netfilter 在节点级别,所以 iptables 规则只针对节点,所以 istio 可能会在 initContainer 上用 pod ip 注入 iptable 规则
但是我最近在研究chaos-mesh,它打破了这一点,我尝试使用nsexec
我在节点A上创建一个demo pod并执行nsexec -n /proc/xxxxxx/ns/net -l iptables -L
,iptable规则与节点规则不同
当我尝试添加输出规则时,它运行良好,仅适用于此 pod
netfilter 是否按名称空间隔离?
is netfilter isolation by namespace?
可以be done.
...a demo pod on node A and execute nsexec -n /proc/xxxxxx/ns/net -l iptables -L, iptable rules is different from node rules
这里发生的是 nsexec
从它自己的挂载命名空间加载 iptables
并在 pod 隔离命名空间中执行它。如您所愿,pod 获得了不同的 iptables 规则。