Add multiple network interfaces inside a pod in Kubernetes

I’m trying to add a second network interface in Docker containers (with only Docker, I simply add my container to another “docker network” using the docker network command) in Kubernetes such that containers are also able to communicate together through this second interface.

The thing is that it is not possible to simply call the docker network command. I get the following error: Container sharing network namespace with another container or host cannot be connected to any other network.

  • Connect docker container to both internet and VPN
  • multiple django requirements with docker
  • docker remote api cannot bind a port to a host
  • Jupyter kernel crashing in docker container
  • a ssh issue when tried to rebuild a node.js image with
  • AWS ECR Authentication Test
  • This error seems logic to me as the network is not managed the same way with Kubernetes (all containers in a pod share their IP if I understood correctly). But now the question is: how can I add a second network interface easily to my container (or to my pod)?

    I did some research and I found that Kubernetes is able to use CNI and that it could be my solution. But I was unable to have it working (don’t know if the error is on my side or because everything is continuously evolving). I also searched for other solutions in the Kubernetes documentation, but I don’t know if one of them can make me happy in an easy way 🙂

    Thanks for your help!

    P.S.: For a bit more context, I am creating containers with an application that needs to have two working interfaces (I cannot modify this application to use only one NIC) and I’m trying to have it working on my laptop (local Kubernetes/Docker installation) without needing replication on multiple nodes.

  • Is it safe to delete docker logs generated at /var/lib/docker/containers/HASH
  • Can't pull docker image: no route to host
  • docker aufs to devicemapper docker container and images migration
  • How do I stop docker's virtual machine so I can install VirtualBox?
  • Getting console output from Docker container
  • Unable to run Watchtower - FATA[0000] /var/run/docker.sock: no such file or director
  • One Solution collect form web for “Add multiple network interfaces inside a pod in Kubernetes”

    This is probably not going to be available by Kubernetes since network is not a first class object. It makes more sense for your application to work off of a single interface.

    Another option is for you to manage your own network namespace and keep this container(s) out of the scope of Kubernetes. So all the network plugging will have to be done by you including scheduling of this.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.