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 O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.