Docker allows you to specify different types of networking for your containers. One type that is very handy and used in Kubernetes is the container type. It allows you to share a network between two containers. In this exercise, you will illustrate this with three bash commands:
On a Docker host, start a busybox container that just waits. Then, start another container, using the
docker run -d --name=source busybox sleep 3600
docker run -d --name=same-ip --net=container:source busybox sleep 3600
Now, check the IP address of each container, something like the following should do:
docker exec -ti same-ip ifconfig
You should see that the second container inherited the same IP address as the source container. That is because, using the Docker --net option, we were able to use the same networking namespace to both containers.
That is what makes a Kubernetes POD, a set of containers running on the same host and that share the same networking namespace. This is what Kubernetes calls the single IP-per-Pod model: making a Pod almost look like a virtual machine running multiple processes with a single IP address.