EndpointSlices

Endpoints, EndpointSlices and Service Discovery

The EndpointSlice controller evaluates each selector and writes the matching Pods' addresses, ports and readiness into EndpointSlice objects, which kube-proxy and CoreDNS 366,312 watch. The older Endpoints object is deprecated since Kubernetes 1.33 5,150 :

The slice behind the api Service, and the deprecated Endpoints viewShell
kubectl get endpointslices -l kubernetes.io/service-name=api
kubectl get endpoints api
kubectl exec deploy/api -- printenv | grep '^DB_SERVICE'
Output
NAME        ADDRESSTYPE   PORTS   ENDPOINTS                                AGE
api-d897w   IPv4          3000    10.244.1.105,10.244.1.106,10.244.1.104   5s
Warning: v1 Endpoints is deprecated in v1.33+; use discovery.k8s.io/v1 EndpointSlice
NAME   ENDPOINTS                                               AGE
api    10.244.1.104:3000,10.244.1.105:3000,10.244.1.106:3000   5s
DB_SERVICE_HOST=10.96.28.125
DB_SERVICE_PORT=5432

An unready Pod stays in its slice marked ready: false and gets no traffic, as in Rollout Health. A slice holds up to 100 endpoints, so a change rewrites one slice, not a huge object. The last command shows the oldest discovery method, <NAME>_SERVICE_HOST variables, set only for Services that existed when the Pod started; prefer DNS.