Chapter 4. Kubernetes Networking Introduction
Now that we have covered Linux and container networking’s critical components, we are ready to discuss Kubernetes networking in greater detail. In this chapter, we will discuss how pods connect internally and externally to the cluster. We will also cover how the internal components of Kubernetes connect. Higher-level network abstractions around discovery and load balancing, such as services and ingresses, will be covered in the next chapter.
Kubernetes networking looks to solve these four networking issues:
-
Highly coupled container-to-container communications
-
Pod-to-pod communications
-
Pod-to-service communications
-
External-to-service communications
The Docker networking model uses a virtual bridge network by default, which is defined per host and is a private network where containers attach. The container’s IP address is allocated a private IP address, which implies containers running on different machines cannot communicate with each other. Developers will have to map host ports to container ports and then proxy the traffic to reach across nodes with Docker. In this scenario, it is up to the Docker administrators to avoid port clashes between containers; usually, this is the system administrators. The Kubernetes networking handles this differently.
The Kubernetes Networking Model
The Kubernetes networking model natively supports multihost cluster networking. Pods can communicate with each other by default, regardless of ...