Concepts

Kubernetes v1.16 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date documentation, see the latest version.

Edit This Page

Endpoint Slices

FEATURE STATE: Kubernetes v1.16 alpha
This feature is currently in a alpha state, meaning:

  • The version names contain alpha (e.g. v1alpha1).
  • Might be buggy. Enabling the feature may expose bugs. Disabled by default.
  • Support for feature may be dropped at any time without notice.
  • The API may change in incompatible ways in a later software release without notice.
  • Recommended for use only in short-lived testing clusters, due to increased risk of bugs and lack of long-term support.

Endpoint Slices provide a simple way to track network endpoints within a Kubernetes cluster. They offer a more scalable and extensible alternative to Endpoints.

Endpoint Slice resources

In Kubernetes, an Endpoint Slice contains references to a set of network endpoints. The EndpointSlice controller automatically creates Endpoint Slices for a Kubernetes Service when a selector is specified. These Endpoint Slices will include references to any Pods that match the Service selector. Endpoint Slices group network endpoints together by unique Service and Port combinations.

As an example, here’s a sample EndpointSlice resource for the example Kubernetes Service.

apiVersion: discovery.k8s.io/v1alpha1
kind: EndpointSlice
metadata:
  name: example-abc
  labels:
    kubernetes.io/service-name: example
addressType: IP
ports:
  - name: http
    protocol: TCP
    port: 80
endpoints:
  - addresses:
    - "10.1.2.3"
    - "2001:db8::1234:5678"
    conditions:
      ready: true
    hostname: pod-1
    topology:
      kubernetes.io/hostname: node-1
      topology.kubernetes.io/zone: us-west2-a

By default, Endpoint Slices managed by the EndpointSlice controller will have no more than 100 endpoints each. Below this scale, Endpoint Slices should map 1:1 with Endpoints and Services and have similar performance.

Endpoint Slices can act as the source of truth for kube-proxy when it comes to how to route internal traffic. When enabled, they should provide a performance improvement for services with large numbers of endpoints.

Motivation

The Endpoints API has provided a simple and straightforward way of tracking network endpoints in Kubernetes. Unfortunately as Kubernetes clusters and Services have gotten larger, limitations of that API became more visible. Most notably, those included challenges with scaling to larger numbers of network endpoints.

Since all network endpoints for a Service were stored in a single Endpoints resource, those resources could get quite large. That affected the performance of Kubernetes components (notably the master control plane) and resulted in significant amounts of network traffic and processing when Endpoints changed. Endpoint Slices help you mitigate those issues as well as provide an extensible platform for additional features such as topological routing.

What's next

Feedback