Skip to content

Commit 3cb9ee4

Browse files
andrewsykimPI-Victor
authored andcommitted
Document the ProxyTerminatingEndpoints feature
Document Service Traffic Policies Signed-off-by: Andrew Sy Kim <[email protected]> Reviewed-by: Victor Palade <[email protected]>
1 parent 50c97b2 commit 3cb9ee4

File tree

1 file changed

+34
-0
lines changed
  • content/en/docs/concepts/services-networking

1 file changed

+34
-0
lines changed

content/en/docs/concepts/services-networking/service.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,40 @@ The IP address that you choose must be a valid IPv4 or IPv6 address from within
384384
If you try to create a Service with an invalid clusterIP address value, the API
385385
server will return a 422 HTTP status code to indicate that there's a problem.
386386

387+
## Traffic policies
388+
389+
### External traffic policy
390+
391+
You can set the `spec.externalTrafficPolicy` field to control how traffic from external sources is routed.
392+
Valid values are `Cluster` and `Local`. Set the field to `Cluster` to route external traffic to all ready endpoints
393+
and `Local` to only route to ready node-local endpoints. If the traffic policy is `Local` and there are are no node-local
394+
endpoints, the kube-proxy does not forward any traffic for the relevant Service.
395+
396+
{{< note >}}
397+
{{< feature-state for_k8s_version="v1.22" state="alpha" >}}
398+
If you enable the `ProxyTerminatingEndpoints`
399+
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
400+
`ProxyTerminatingEndpoints` for the kube-proxy, the kube-proxy checks if the node
401+
has local endpoints and whether or not all the local endpoints are marked as terminating.
402+
If there are local endpoints and **all** of those are terminating, then the kube-proxy ignores
403+
any external traffic policy of `Local`. Instead, whilst the node-local endpoints remain as all
404+
terminating, the kube-proxy forwards traffic for that Service to healthy endpoints elsewhere,
405+
as if the external traffic policy were set to `Cluster`.
406+
This forwarding behavior for terminating endpoints exists to allow external load balancers to
407+
gracefully drain connections that are backed by `NodePort` Services, even when the health check
408+
node port starts to fail. Otherwise, traffic can be lost between the time a node is still in the node pool of a load
409+
balancer and traffic is being dropped during the termination period of a pod.
410+
{{< /note >}}
411+
412+
### Internal traffic policy
413+
414+
{{< feature-state for_k8s_version="v1.22" state="beta" >}}
415+
416+
You can set the `spec.internalTrafficPolicy` field to control how traffic from internal sources is routed.
417+
Valid values are `Cluster` and `Local`. Set the field to `Cluster` to route internal traffic to all ready endpoints
418+
and `Local` to only route to ready node-local endpoints. If the traffic policy is `Local` and there are are no node-local
419+
endpoints, traffic is dropped by kube-proxy.
420+
387421
## Discovering services
388422

389423
Kubernetes supports 2 primary modes of finding a Service - environment

0 commit comments

Comments
 (0)