Pods are the basic building blocks of an application running in Kubernetes. Most applications are distributed across multiple components, and you model those in Kubernetes using a Pod for each component. For example, you may have a website Pod and an API Pod, or you may have dozens of Pods in a microservice architecture. They all need to communicate, and Kubernetes supports the standard networking protocols, TCP and UDP. Both protocols use IP addresses to route traffic, but IP addresses change when Pods are replaced, so Kubernetes provides a network address discovery mechanism with Services.
Services are flexible resources that support routing traffic between Pods, into Pods from the world outside the cluster, and from Pods to external systems. In this chapter, you’ll learn all the different Service configurations Kubernetes provides to glue systems together, and you’ll understand how they work transparently for your apps.