与主机共享networking资源时出错

我们尝试使用Kubernetes来实现OpenStack 。 当我们删除并重新启动运行l3-agent and openvswitch-agent的容器时,在执行与命名空间相关的commd时会发现一些错误。 例如,当我们执行ip netns list ,我们得到

RTNETLINK答案:无效的参数。

这些情况可以通过以下步骤重新生成。

为了简单起见,我们使用tomcat image而不是l3-agent image

步骤1: Set the MountFlags=shared in /lib/systemd/system/docker.service and restart docker.

第二步: Build a container. docker run --privileged -it --net=host -v /run:/run:rw -v /run/netns:/run/netns:shared tomcat sh Build a container. docker run --privileged -it --net=host -v /run:/run:rw -v /run/netns:/run/netns:shared tomcat sh

第三步: Add namespace in the container. ip netns add test-1 Add namespace in the container. ip netns add test-1

第四步: Delete the container and add a new namespace in the host. ip netns add test-2 Delete the container and add a new namespace in the host. ip netns add test-2

第五步: Build a new container. docker run --privileged -it --net=host -v /run:/run:rw -v /run/netns:/run/netns:shared tomcat sh Build a new container. docker run --privileged -it --net=host -v /run:/run:rw -v /run/netns:/run/netns:shared tomcat sh

第六步: Show the namespace in the new container, then we can see the error message, RTNETLINK answers: Invalid argument.

任何机构能帮助我们解决这个问题吗? 谢谢。