Kubernetes is dynamic. Pods are created and deleted all the time. The Kubernetes service is an abstraction to define a set of pods by label selectors. We normally use the service to access pods instead of specifying a pod explicitly. When we create a service, an endpoint object will be created, which describes a set of pod IPs that the label selector in that service has selected.
In some cases, the endpoint
object will not be created upon creation of the service. For example, services without selectors will not create a corresponding endpoint
object. For more information, refer to the Service without selectors
section in Chapter 3, Getting Started with Kubernetes
So, how does traffic get from pod to the pod ...
Get DevOps with Kubernetes - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.