πŸ“šBook Signing at KubeCon EU 2026Meet us at Booking.com HQ (Mon 18:30-21:00) & vCluster booth #521 (Tue 24 Mar, 12:30-1:30pm) β€” free book giveaway!RSVP Booking.com Event
Networking intermediate ⏱ 15 minutes K8s 1.28+

Kubernetes EndpointSlices Explained

Understand Kubernetes EndpointSlices for scalable service endpoint management. How they improve on Endpoints objects for large clusters with thousands of pods.

By Luca Berton β€’ β€’ πŸ“– 5 min read

πŸ’‘ Quick Answer: networking

The Problem

This is a fundamental Kubernetes topic that engineers search for frequently. A comprehensive reference with production-ready examples saves hours of trial and error.

The Solution

EndpointSlices vs Endpoints

# Old: Endpoints (one object per Service, all IPs)
kubectl get endpoints my-service
# NAME         ENDPOINTS
# my-service   10.244.1.5:80,10.244.2.8:80,...  # Gets huge!

# New: EndpointSlices (chunked into ~100 endpoints each)
kubectl get endpointslices -l kubernetes.io/service-name=my-service
# NAME                  ADDRESSTYPE   PORTS   ENDPOINTS   AGE
# my-service-abc12      IPv4          80      100         1h
# my-service-def34      IPv4          80      100         1h
# my-service-ghi56      IPv4          80      50          1h

Why EndpointSlices Matter

FeatureEndpointsEndpointSlices
Max size1 object, grows unbounded~100 endpoints per slice
Update costUpdate entire objectUpdate only changed slice
Dual-stackOne object for IPv4+IPv6Separate slices per address type
Topology hintsβŒβœ… (route to same zone)
Default sinceLegacyK8s 1.21+ (default)

Topology-Aware Routing

# EndpointSlice with topology hints
apiVersion: v1
kind: Service
metadata:
  name: my-service
  annotations:
    service.kubernetes.io/topology-mode: Auto
spec:
  selector:
    app: web
  ports:
    - port: 80
# Kubernetes routes traffic to pods in the same zone when possible
# Reduces cross-zone data transfer costs!
graph TD
    A[Service: 250 pods] -->|Old: Endpoints| B[1 object with 250 IPs]
    B -->|Any change| C[Re-sync entire 250-IP object]
    A -->|New: EndpointSlices| D[Slice 1: 100 IPs]
    A --> E[Slice 2: 100 IPs]
    A --> F[Slice 3: 50 IPs]
    D -->|1 pod changes| G[Re-sync only Slice 1]

Frequently Asked Questions

Do I need to do anything to use EndpointSlices?

No β€” EndpointSlices are the default since K8s 1.21. The EndpointSlice controller automatically creates and manages them for every Service. You benefit automatically.

Best Practices

  • Start with the simplest configuration that meets your needs
  • Test changes in staging before production
  • Use kubectl describe and events for troubleshooting
  • Document your decisions for the team

Key Takeaways

  • This is essential Kubernetes knowledge for production operations
  • Follow the principle of least privilege and minimal configuration
  • Monitor and iterate based on real-world behavior
  • Automation reduces human error and improves consistency
#endpointslices #endpoints #service-discovery #networking #scalability
Luca Berton
Written by Luca Berton

Principal Solutions Architect specializing in Kubernetes, AI/GPU infrastructure, and cloud-native platforms. Author of Kubernetes Recipes and creator of CopyPasteLearn courses.

Kubernetes Recipes book cover

Want More Kubernetes Recipes?

This recipe is from Kubernetes Recipes, our 750-page practical guide with hundreds of production-ready patterns.

Luca Berton Ansible Pilot Ansible by Example Open Empower K8s Recipes Terraform Pilot CopyPasteLearn ProteinLens