A Practical Way to Integrate Podman Containers into an Open vSwitch Network
I use Open vSwitch to connect my virtual machines, which works well when everything involved is a VM. The problem arises when I want a Podman container to participate in the same network and communicate directly with those VMs. Podman does not offer a simple --network openvswitch flag, so the solution is less obvious than it should be. Fortunately, it is also not especially complicated once you understand the pieces involved.
Podman does provide one option that makes this possible: --network ns:…. Instead of attaching the container to a predefined Podman network, this option allows the container to join an existing Linux network namespace. If I can place an Open vSwitch interface inside a namespace that Podman uses, the container becomes just another endpoint on the Open vSwitch bridge.
Creating the network namespace
The first step is to create a dedicated network namespace for the container. In this example, I name it podman-c1:
ip netns add podman-c1
ip netns add podman-c1
Next, I create an internal port on my Open vSwitch bridge. My bridge is called ivs, and I create an internal interface named ivs123:
ovs-vsctl add-port ivs ivs123 -- set interface ivs123 type=internal
ovs-vsctl add-port ivs ivs123 -- set interface ivs123 type=internal


