EndpointSlice — scalable replacement for Endpoints for large Services.
Endpoints problem: single object = all Pod IPs. With 10k+ Pods the object becomes huge.
EndpointSlice: splits into multiple objects (100 endpoints each).
Example:
1apiVersion: discovery.k8s.io/v12kind: EndpointSlice3metadata:4 name: myapp-abc1235 namespace: production6 labels:7 kubernetes.io/service-name: myapp8addressType: IPv49ports:10 - name: http11 port: 808012 protocol: TCP13endpoints:14 - addresses:15 - "10.0.0.5"16 conditions:17 ready: true18 serving: true19 terminating: false20 nodeName: node-121 zone: us-east-1a22 - addresses:23 - "10.0.1.8"24 conditions:25 ready: true26 serving: true27 terminating: false28 nodeName: node-229 zone: us-east-1b
Topology-aware routing (K8s 1.27+):
1apiVersion: v12kind: Service3metadata:4 name: myapp5 annotations:6 service.kubernetes.io/topology-mode: Auto7spec:8 internalTrafficPolicy: Local9 ...
internalTrafficPolicy: Local — traffic goes only to own zone (reduces latency and cost).
Verification: kubectl get endpointslices -l kubernetes.io/service-name=myapp.