为什么 initContainer `istio-init` 中的 iptables 规则设置在应用程序容器中有效?
Why iptables rule setup in initContainer `istio-init` works in application container?
我正在阅读 istio 的文档。它说:
istio-init This init container is used to setup the iptables rules so that inbound/outbound traffic will go through the sidecar proxy.
据我了解,initContainer 和应用程序容器是分开的,只是它们共享相同的网络名称空间。那么为什么 initContainer 中的 iptables 设置仍然存在于应用程序容器中?
单个网络命名空间在所有进程命名空间(这意味着 pod 将启动的其他容器)之间共享一个(虚拟)网络适配器。这是持久化更改的地方。
Iptables 配置网络命名空间中设置的规则来配置共享适配器,因此当应用程序容器和边车稍后在同一网络命名空间中启动并使用相同的适配器时,init 容器中的网络更改会持续存在。
正如我在评论中提到的,Iptables规则被简要描述here。
还有一个Iptables原理图:
我正在阅读 istio 的文档。它说:
istio-init This init container is used to setup the iptables rules so that inbound/outbound traffic will go through the sidecar proxy.
据我了解,initContainer 和应用程序容器是分开的,只是它们共享相同的网络名称空间。那么为什么 initContainer 中的 iptables 设置仍然存在于应用程序容器中?
单个网络命名空间在所有进程命名空间(这意味着 pod 将启动的其他容器)之间共享一个(虚拟)网络适配器。这是持久化更改的地方。
Iptables 配置网络命名空间中设置的规则来配置共享适配器,因此当应用程序容器和边车稍后在同一网络命名空间中启动并使用相同的适配器时,init 容器中的网络更改会持续存在。
正如我在评论中提到的,Iptables规则被简要描述here。
还有一个Iptables原理图: