Setting the Scene
Before diving in, we need to remind ourselves that Pod IPs are unreliable. When Pods fail, they get replaced with new Pods that have new IPs. Scaling up a Deployment introduces new Pods with new IP addresses. Scaling down a Deployment removes Pods. All of this creates a large amount of IP churn, and creates a situation where Pod IPs cannot be relied on.
We also need to know three fundamental things about Kubernetes Services.
First, we need to clear up some terminology. When talking about a Service in this chapter, we're talking about the Service REST object in the Kubernetes API. Just like a Pod, ReplicaSet, or Deployment, a Kubernetes Service is an object in the API that we define in a manifest and POST to the API server.
Second, we need to know that every Service gets its own stable IP address, its own stable DNS name, and its own stable port.
Third, we need to know that Services use labels to dynamically select the Pods in the cluster they will...