Networking on Kubernetes
Kubernetes operates a flat private network among all the resources in a Kubernetes cluster. Within a cluster, all Pods can communicate with each other cluster-wide without a network address translation (NAT). Kubernetes gives each Pod its own cluster private IP address, which is the same IP address seen by the Pod itself and what others see it as. All containers inside a single Pod can reach each container’s port on the localhost. All nodes in a cluster have their individually assigned IP addresses as well and can communicate with all Pods without a NAT. The following figure shows the different IP assignments for Pods and nodes, and communication flows from different resources:
Figure 6.6: IP assignments and communication flow
Sometimes, you might need a set of Pods running the same application container (the container for an nginx
application) for high availability and load balancing, for example. Instead of calling each Pod by its private...