@@ -19,8 +19,7 @@ description: >-
1919{{< feature-state for_k8s_version="v1.21" state="stable" >}}
2020
2121Kubernetes' _ EndpointSlice_ API provides a way to track network endpoints
22- within a Kubernetes cluster. EndpointSlices offer a more scalable and extensible
23- alternative to [ Endpoints] ( /docs/concepts/services-networking/service/#endpoints ) .
22+ within a Kubernetes cluster.
2423
2524<!-- body -->
2625
@@ -31,8 +30,8 @@ endpoints. The control plane automatically creates EndpointSlices
3130for any Kubernetes Service that has a {{< glossary_tooltip text="selector"
3231term_id="selector" >}} specified. These EndpointSlices include
3332references to all the Pods that match the Service selector. EndpointSlices group
34- network endpoints together by unique combinations of protocol, port number, and
35- Service name.
33+ network endpoints together by unique combinations of IP family, protocol,
34+ port number, and Service name.
3635The name of a EndpointSlice object must be a valid
3736[ DNS subdomain name] ( /docs/concepts/overview/working-with-objects/names#dns-subdomain-names ) .
3837
@@ -67,17 +66,16 @@ more than 100 endpoints each. You can configure this with the
6766{{< glossary_tooltip text="kube-controller-manager" term_id="kube-controller-manager" >}}
6867flag, up to a maximum of 1000.
6968
70- EndpointSlices can act as the source of truth for
69+ EndpointSlices act as the source of truth for
7170{{< glossary_tooltip term_id="kube-proxy" text="kube-proxy" >}} when it comes to
7271how to route internal traffic.
7372
7473# ## Address types
7574
76- EndpointSlices support three address types :
75+ EndpointSlices support two address types :
7776
7877* IPv4
7978* IPv6
80- * FQDN (Fully Qualified Domain Name)
8179
8280Each `EndpointSlice` object represents a specific IP address type. If you have
8381a Service that is available via IPv4 and IPv6, there will be at least two
@@ -86,42 +84,37 @@ a Service that is available via IPv4 and IPv6, there will be at least two
8684# ## Conditions
8785
8886The EndpointSlice API stores conditions about endpoints that may be useful for consumers.
89- The three conditions are `ready`, `serving`, and `terminating`.
90-
91- # ### Ready
92-
93- ` ready` is a condition that maps to a Pod's `Ready` condition. A running Pod with the `Ready`
94- condition set to `True` should have this EndpointSlice condition also set to `true`. For
95- compatibility reasons, `ready` is NEVER `true` when a Pod is terminating. Consumers should refer
96- to the `serving` condition to inspect the readiness of terminating Pods. The only exception to
97- this rule is for Services with `spec.publishNotReadyAddresses` set to `true`. Endpoints for these
98- Services will always have the `ready` condition set to `true`.
87+ The three conditions are `serving`, `terminating`, and `ready`.
9988
10089# ### Serving
10190
10291{{< feature-state for_k8s_version="v1.26" state="stable" >}}
10392
104- The `serving` condition is almost identical to the `ready` condition. The difference is that
105- consumers of the EndpointSlice API should check the `serving` condition if they care about pod readiness while
106- the pod is also terminating .
93+ The `serving` condition indicates that the endpoint is currently serving responses, and
94+ so it should be used as a target for Service traffic. For endpoints backed by a Pod, this
95+ maps to the Pod's `Ready` condition .
10796
108- {{< note >}}
97+ # ### Terminating
10998
110- Although `serving` is almost identical to `ready`, it was added to prevent breaking the existing meaning
111- of `ready`. It may be unexpected for existing clients if `ready` could be `true` for terminating
112- endpoints, since historically terminating endpoints were never included in the Endpoints or
113- EndpointSlice API to begin with. For this reason, `ready` is _always_ `false` for terminating
114- endpoints, and a new condition `serving` was added in v1.20 so that clients can track readiness
115- for terminating pods independent of the existing semantics for `ready`.
99+ {{< feature-state for_k8s_version="v1.26" state="stable" >}}
116100
117- {{< /note >}}
101+ The `terminating` condition indicates that the endpoint is
102+ terminating. For endpoints backed by a Pod, this condition is set when
103+ the Pod is first deleted (that is, when it receives a deletion
104+ timestamp, but most likely before the Pod's containers exit).
118105
119- # ### Terminating
106+ Service proxies will normally ignore endpoints that are `terminating`,
107+ but they may route traffic to endpoints that are both `serving` and
108+ ` terminating` if all available endpoints are `terminating`. (This
109+ helps to ensure that no Service traffic is lost during rolling updates
110+ of the underlying Pods.)
120111
121- {{< feature-state for_k8s_version="v1.22" state="beta" >}}
112+ # ### Ready
122113
123- ` Terminating` is a condition that indicates whether an endpoint is terminating.
124- For pods, this is any pod that has a deletion timestamp set.
114+ The `ready` condition is essentially a shortcut for checking
115+ " `serving` and not `terminating`" (though it will also always be
116+ ` true` for Services with `spec.publishNotReadyAddresses` set to
117+ ` true` ).
125118
126119# ## Topology information {#topology}
127120
@@ -133,18 +126,6 @@ per endpoint fields on EndpointSlices:
133126* `nodeName` - The name of the Node this endpoint is on.
134127* `zone` - The zone this endpoint is in.
135128
136- {{< note >}}
137- In the v1 API, the per endpoint `topology` was effectively removed in favor of
138- the dedicated fields `nodeName` and `zone`.
139-
140- Setting arbitrary topology fields on the `endpoint` field of an `EndpointSlice`
141- resource has been deprecated and is not supported in the v1 API.
142- Instead, the v1 API supports setting individual `nodeName` and `zone` fields.
143- These fields are automatically translated between API versions. For example, the
144- value of the `"topology.kubernetes.io/zone"` key in the `topology` field in
145- the v1beta1 API is accessible as the `zone` field in the v1 API.
146- {{< /note >}}
147-
148129# ## Management
149130
150131Most often, the control plane (specifically, the endpoint slice
@@ -169,34 +150,12 @@ slice object tracks endpoints for. This ownership is indicated by an owner
169150reference on each EndpointSlice as well as a `kubernetes.io/service-name`
170151label that enables simple lookups of all EndpointSlices belonging to a Service.
171152
172- # ## EndpointSlice mirroring
173-
174- In some cases, applications create custom Endpoints resources. To ensure that
175- these applications do not need to concurrently write to both Endpoints and
176- EndpointSlice resources, the cluster's control plane mirrors most Endpoints
177- resources to corresponding EndpointSlices.
178-
179- The control plane mirrors Endpoints resources unless :
180-
181- * the Endpoints resource has a `endpointslice.kubernetes.io/skip-mirror` label
182- set to `true`.
183- * the Endpoints resource has a `control-plane.alpha.kubernetes.io/leader`
184- annotation.
185- * the corresponding Service resource does not exist.
186- * the corresponding Service resource has a non-nil selector.
187-
188- Individual Endpoints resources may translate into multiple EndpointSlices. This
189- will occur if an Endpoints resource has multiple subsets or includes endpoints
190- with multiple IP families (IPv4 and IPv6). A maximum of 1000 addresses per
191- subset will be mirrored to EndpointSlices.
192-
193153# ## Distribution of EndpointSlices
194154
195155Each EndpointSlice has a set of ports that applies to all endpoints within the
196156resource. When named ports are used for a Service, Pods may end up with
197157different target port numbers for the same named port, requiring different
198- EndpointSlices. This is similar to the logic behind how subsets are grouped
199- with Endpoints.
158+ EndpointSlices.
200159
201160The control plane tries to fill EndpointSlices as full as possible, but does not
202161actively rebalance them. The logic is fairly straightforward :
@@ -244,34 +203,36 @@ You can find a reference implementation for how to perform this endpoint aggrega
244203and deduplication as part of the `EndpointSliceCache` code within `kube-proxy`.
245204{{< /note >}}
246205
247- # # Comparison with Endpoints {#motivation}
248-
249- The original Endpoints API provided a simple and straightforward way of
250- tracking network endpoints in Kubernetes. As Kubernetes clusters
251- and {{< glossary_tooltip text="Services" term_id="service" >}} grew to handle
252- more traffic and to send more traffic to more backend Pods, the
253- limitations of that original API became more visible.
254- Most notably, those included challenges with scaling to larger numbers of
255- network endpoints.
256-
257- Since all network endpoints for a Service were stored in a single Endpoints
258- object, those Endpoints objects could get quite large. For Services that stayed
259- stable (the same set of endpoints over a long period of time) the impact was
260- less noticeable; even then, some use cases of Kubernetes weren't well served.
261-
262- When a Service had a lot of backend endpoints and the workload was either
263- scaling frequently, or rolling out new changes frequently, each update to
264- the single Endpoints object for that Service meant a lot of traffic between
265- Kubernetes cluster components (within the control plane, and also between
266- nodes and the API server). This extra traffic also had a cost in terms of
267- CPU use.
268-
269- With EndpointSlices, adding or removing a single Pod triggers the same _number_
270- of updates to clients that are watching for changes, but the size of those
271- update message is much smaller at large scale.
272-
273- EndpointSlices also enabled innovation around new features such dual-stack
274- networking and topology-aware routing.
206+ # ## EndpointSlice mirroring
207+
208+ {{< feature-state for_k8s_version="v1.33" state="deprecated" >}}
209+
210+ The EndpointSlice API is a replacement for the older Endpoints API. To
211+ preserve compatibility with older controllers and user workloads that
212+ expect {{<glossary_tooltip term_id="kube-proxy" text="kube-proxy">}}
213+ to route traffic based on Endpoints resources, the cluster's control
214+ plane mirrors most user-created Endpoints resources to corresponding
215+ EndpointSlices.
216+
217+ (However, this feature, like the rest of the Endpoints API, is
218+ deprecated. Users who manually specify endpoints for selectorless
219+ Services should do so by creating EndpointSlice resources directly,
220+ rather than by creating Endpoints resources and allowing them to be
221+ mirrored.)
222+
223+ The control plane mirrors Endpoints resources unless :
224+
225+ * the Endpoints resource has a `endpointslice.kubernetes.io/skip-mirror` label
226+ set to `true`.
227+ * the Endpoints resource has a `control-plane.alpha.kubernetes.io/leader`
228+ annotation.
229+ * the corresponding Service resource does not exist.
230+ * the corresponding Service resource has a non-nil selector.
231+
232+ Individual Endpoints resources may translate into multiple EndpointSlices. This
233+ will occur if an Endpoints resource has multiple subsets or includes endpoints
234+ with multiple IP families (IPv4 and IPv6). A maximum of 1000 addresses per
235+ subset will be mirrored to EndpointSlices.
275236
276237# # {{% heading "whatsnext" %}}
277238
0 commit comments