A Kubernetes Service gives applications a stable networking layer when Pods may run on different nodes. It accepts traffic and routes it to matching Pods, avoiding direct connections to changing Pod addresses. Port forwarding remains useful for testing, but Services model application traffic for regular exposure. section 15.2
A Service connects to Pods through labels and selectors:
- No matching Pods means the Service cannot forward traffic. section 15.2
- One matching Pod receives all traffic. section 15.2
- Several matching Pods receive distributed traffic, making the Service act as a load balancer. section 15.2
Route traffic to the numbers API
Label the Pod with app=numbers and component=api. Configure the Service to listen on port 8015, target the Pod's named http port, and select those labels. Apply the Service, inspect it with kubectl describe svc numbers-api, then test it with curl http://localhost:8015/rng.











