36-Endpoint Slices

Endpoint Slices

FEATURE STATE: Kubernetes v1.16 alpha

Endpoint Slices provide a simple way to track network endpoints within a Kubernetes cluster. They offer a more scalable and extensible alternative to Endpoints. 端点切片提供了一种在kubernetes集群中跟踪网络端点的简单方法。它们提供了一种更具伸缩性和可扩展性的端点替代方案。

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. 在kubernetes中,端点片包含对一组网络端点的引用。当指定选择器时,endpointslice控制器自动为kubernetes服务创建端点片。这些端点切片将包括对与服务选择器匹配的任何pod的引用。端点切片通过唯一的服务和端口组合将网络端点组合在一起。

As an example, here’s a sample EndpointSlice resource for the example Kubernetes Service. 例如,这里是“example”kubernetes服务的endpointslice资源示例。

apiVersion: discovery.k8s.io/v1alpha1
kind: EndpointSlice
  name: example-abc
    kubernetes.io/service-name: example
addressType: IP
  - name: http
    protocol: TCP
    port: 80
  - addresses:
    - ""
    - "2001:db8::1234:5678"
      ready: true
    hostname: pod-1
      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. 默认情况下,由endpointslice控制器管理的端点切片每个端点不超过100个。在这个比例之下,端点切片应该与端点和服务的比例为1:1,并且具有类似的性能。

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. 当涉及到如何路由内部流量时,端点切片可以作为kube代理的真实来源。启用后,它们应该为具有大量端点的服务提供性能改进。


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. endpoints api提供了一种简单而直接的方法来跟踪kubernetes中的网络端点。不幸的是,随着kubernetes集群和服务变得越来越大,api的局限性变得更加明显。最值得注意的是,这些挑战包括扩展到更多的网络端点。

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. 由于服务的所有网络终结点都存储在单个终结点资源中,因此这些资源可能会变得非常大。这会影响kubernetes组件(尤其是主控制平面)的性能,并在端点发生更改时导致大量网络流量和处理。端点切片可以帮助您减轻这些问题,并为其他功能(如拓扑路由)提供一个可扩展的平台。

What's next


Was this page helpful?

本作品采用《CC 协议》,转载必须注明作者和本文链接
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!