Skip to content

Commit f5ca94b

Browse files
authored
Merge pull request #45678 from alexanderConstantinescu/kep-3836
KEP-3836 documentation for 1.30
2 parents b28f917 + c94d2eb commit f5ca94b

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,16 @@ You can integrate with [Gateway](https://gateway-api.sigs.k8s.io/) rather than S
619619
can define your own (provider specific) annotations on the Service that specify the equivalent detail.
620620
{{< /note >}}
621621

622+
#### Node liveness impact on load balancer traffic
623+
624+
Load balancer health checks are critical to modern applications. They are used to
625+
determine which server (virtual machine, or IP address) the load balancer should
626+
dispatch traffic to. The Kubernetes APIs do not define how health checks have to be
627+
implemented for Kubernetes managed load balancers, instead it's the cloud providers
628+
(and the people implementing integration code) who decide on the behavior. Load
629+
balancer health checks are extensively used within the context of supporting the
630+
`externalTrafficPolicy` field for Services.
631+
622632
#### Load balancers with mixed protocol types
623633

624634
{{< feature-state feature_gate_name="MixedProtocolLBService" >}}

content/en/docs/reference/command-line-tools-reference/feature-gates/kube-proxy-draining-terminating-nodes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ stages:
99
- stage: alpha
1010
defaultValue: false
1111
fromVersion: "1.28"
12+
toVersion: "1.30"
13+
- stage: beta
14+
defaultValue: true
15+
fromVersion: "1.30"
1216
---
1317
Implement connection draining for
1418
terminating nodes for `externalTrafficPolicy: Cluster` services.

content/en/docs/reference/networking/ports-and-protocols.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ etcd cluster externally or on custom ports.
2727
| Protocol | Direction | Port Range | Purpose | Used By |
2828
|----------|-----------|-------------|-----------------------|-------------------------|
2929
| TCP | Inbound | 10250 | Kubelet API | Self, Control plane |
30+
| TCP | Inbound | 10256 | kube-proxy | Self, Load balancers |
3031
| TCP | Inbound | 30000-32767 | NodePort Services† | All |
3132

3233
† Default port range for [NodePort Services](/docs/concepts/services-networking/service/).

content/en/docs/reference/networking/virtual-ips.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,67 @@ route to ready node-local endpoints. If the traffic policy is `Local` and there
488488
are no node-local endpoints, the kube-proxy does not forward any traffic for the
489489
relevant Service.
490490

491+
If `Cluster` is specified all nodes are eligible load balancing targets _as long as_
492+
the node is not being deleted and kube-proxy is healthy. In this mode: load balancer
493+
health checks are configured to target the service proxy's readiness port and path.
494+
In the case of kube-proxy this evaluates to: `${NODE_IP}:10256/healthz`. kube-proxy
495+
will return either an HTTP code 200 or 503. kube-proxy's load balancer health check
496+
endpoint returns 200 if:
497+
498+
1. kube-proxy is healthy, meaning:
499+
- it's able to progress programming the network and isn't timing out while doing
500+
so (the timeout is defined to be: **2 × `iptables.syncPeriod`**); and
501+
2. the node is not being deleted (there is no deletion timestamp set for the Node).
502+
503+
The reason why kube-proxy returns 503 and marks the node as not
504+
eligible when it's being deleted, is because kube-proxy supports connection
505+
draining for terminating nodes. A couple of important things occur from the point
506+
of view of a Kubernetes-managed load balancer when a node _is being_ / _is_ deleted.
507+
508+
While deleting:
509+
510+
* kube-proxy will start failing its readiness probe and essentially mark the
511+
node as not eligible for load balancer traffic. The load balancer health
512+
check failing causes load balancers which support connection draining to
513+
allow existing connections to terminate, and block new connections from
514+
establishing.
515+
516+
When deleted:
517+
518+
* The service controller in the Kubernetes cloud controller manager removes the
519+
node from the referenced set of eligible targets. Removing any instance from
520+
the load balancer's set of backend targets immediately terminates all
521+
connections. This is also the reason kube-proxy first fails the health check
522+
while the node is deleting.
523+
524+
It's important to note for Kubernetes vendors that if any vendor configures the
525+
kube-proxy readiness probe as a liveness probe: that kube-proxy will start
526+
restarting continuously when a node is deleting until it has been fully deleted.
527+
kube-proxy exposes a `/livez` path which, as opposed to the `/healthz` one, does
528+
**not** consider the Node's deleting state and only its progress programming the
529+
network. `/livez` is therefore the recommended path for anyone looking to define
530+
a livenessProbe for kube-proxy.
531+
532+
Users deploying kube-proxy can inspect both the readiness / liveness state by
533+
evaluating the metrics: `proxy_livez_total` / `proxy_healthz_total`. Both
534+
metrics publish two series, one with the 200 label and one with the 503 one.
535+
536+
For `Local` Services: kube-proxy will return 200 if
537+
538+
1. kube-proxy is healthy/ready, and
539+
2. has a local endpoint on the node in question.
540+
541+
Node deletion does **not** have an impact on kube-proxy's return
542+
code for what concerns load balancer health checks. The reason for this is:
543+
deleting nodes could end up causing an ingress outage should all endpoints
544+
simultaneously be running on said nodes.
545+
546+
The Kubernetes project recommends that cloud provider integration code
547+
configures load balancer health checks that target the service proxy's healthz
548+
port. If you are using or implementing your own virtual IP implementation,
549+
that people can use instead of kube-proxy, you should set up a similar health
550+
checking port with logic that matches the kube-proxy implementation.
551+
491552
### Traffic to terminating endpoints
492553

493554
{{< feature-state for_k8s_version="v1.28" state="stable" >}}

0 commit comments

Comments
 (0)