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.

  • Connecting docker client to remote docker daemon over TLS
  • How to load the Docker Container logs without lines limit
  • Docker Swarm container reachable although port is not open?
  • Starting delayed_job with Dokku
  • Communicate two containers in docker with netcat
  • Adding repos to the dockerfile
  • 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.

  • PyCharm Docker Deployment “[Errno 2] No such file or directory”
  • Shutting down MongoDB inside Docker container causes 100% CPU
  • How to properly set VOLUME and CMD instructions in Postgres Dockerfile?
  • during startup program exited normally. segmentation fault
  • Using tc tbf on veth to limit ingress bandwidth works, but I don't know the detail
  • always npm install locally from package.json
  • 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.