Skip to content

Services and Endpoints

First PublishedByAtif Alam

A Service is a stable front door to a changing set of Pods. The datapath is implemented by kube-proxy (or a CNI that replaces it) plus EndpointSlices that track ready backends.

For a cloud-agnostic view of how pod IPs move across nodes (overlay vs underlay), see Networking — Pod-to-pod traffic (cross-node, generic).

  1. Client Pod resolves the Service DNS name to the ClusterIP (or uses cluster IP directly).
  2. kube-proxy (or eBPF equivalent) programs rules so traffic to ClusterIP:port is DNAT’d to a Pod IP:targetPort.
  3. EndpointSlices hold the current ready Pod endpoints; kube-proxy watches them and refreshes rules.

When pods churn during rollouts, EndpointSlices update; brief windows of empty endpoints can cause 503 if clients retry against backends that no longer exist.

Terminal window
kubectl get endpointslices -n <ns> -l kubernetes.io/service-name=<svc>

Slices split endpoints for scale; only Ready pods appear for Services with selectors. Readiness probe flapping directly shows up as endpoint churn.

ModeCharacteristics
iptablesDefault on many clusters; rule count grows with services/backends
ipvsHash-based dispatch; better behavior at very large service counts
eBPF / no kube-proxyCilium and similar programs datapath in kernel; rich observability (for example Hubble)
Terminal window
kubectl get cm kube-proxy-config -n kube-system -o yaml | grep mode

clusterIP: None — DNS returns per-pod A records (StatefulSet identity). No virtual ClusterIP; clients talk directly to pod IPs.

sessionAffinity: ClientIP pins a client source IP to one backend for sessionAffinityConfig.clientIP.timeoutSeconds. Useful for legacy state; prefer sticky cookies at L7 when using Ingress.

  1. kubectl get endpoints <svc> (legacy view) or EndpointSlices as above — non-empty?
  2. Labels on pods match Service selector?
  3. Readiness passing? (Unready pods are omitted.)
  4. NetworkPolicy allowing the path?
  5. For mesh clusters, confirm whether traffic is captured by sidecars and whether mTLS breaks health checks.