Endpoints
Part of the Introduction to Kubernetes section of Coddy's Terminal journey. Lesson 19 of 45.
How does a Service know which Pods to send traffic to? Through a label selector. kubectl expose copies the Deployment's labels (app=web) into the Service, and every Pod carrying those labels becomes a target.
The current list of targets is the Service's endpoints: the IP and port of every ready Pod behind it.
kubectl get endpoints webScale the Deployment and the endpoints follow. A Pod that is not ready is left out, so traffic only goes where it can be served.
kubectl describe service web shows both sides of the picture: the Selector the Service uses and the Endpoints it currently found. A Service with no endpoints usually means its selector matches no Pods.
Challenge
BeginnerCreate a Deployment named web from the nginx image with 2 replicas, expose it on port 80, then list the endpoints of the web Service to see both Pod addresses.
Try it yourself
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Introduction to Kubernetes
Practice on your own: Terminal playground