CoursesKubernetes administrationNetworking & Service Discovery

Services

Stable identity and load balancing for pods.

Intermediate12 min · lesson 33 of 65
In plain terms
A Service is a company’s main phone number. You always dial the same number, and it quietly routes you to whichever employee is free — you never need to know anyone’s direct desk extension.

Pods are ephemeral and their IPs churn, so nothing should talk to a pod IP directly. A Service is a stable name and virtual IP that load-balances across a label-selected set of ready pods, updated automatically as pods come and go.

A call to a Service
1clientcalls web:802Servicestable ClusterIP3Endpointsready pod IPs4podserves it
The endpoints list tracks label-matched, ready pods. An empty list is a selector or readiness problem — almost never a networking one.

The type decides reach: ClusterIP is in-cluster only (the default), NodePort opens a port on every node, LoadBalancer requests an external IP from the environment. How kube-proxy actually turns a ClusterIP into a pod is the Networking section.

terminal
$ kubectl expose deploy web --port=80 --target-port=80
$ kubectl get endpoints web
NAME ENDPOINTS
web 10.244.1.7:80,10.244.2.4:80