Skip to content

Commit c8acfdd

Browse files
authored
Merge pull request #27092 from XudongLiuHarold/add-service-loadbalancer-class
Add documentation for Service LoadBalancerClass
2 parents 4bef3ee + fcfcc73 commit c8acfdd

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,25 @@ is set to `false` on an existing Service with allocated node ports, those node p
633633
You must explicitly remove the `nodePorts` entry in every Service port to de-allocate those node ports.
634634
You must enable the `ServiceLBNodePortControl` feature gate to use this field.
635635

636+
#### Specifying class of load balancer implementation {#load-balancer-class}
637+
638+
{{< feature-state for_k8s_version="v1.21" state="alpha" >}}
639+
640+
Starting in v1.21, you can optionally specify the class of a load balancer implementation for
641+
`LoadBalancer` type of Service by setting the field `spec.loadBalancerClass`.
642+
By default, `spec.loadBalancerClass` is `nil` and a `LoadBalancer` type of Service uses
643+
the cloud provider's default load balancer implementation.
644+
If `spec.loadBalancerClass` is specified, it is assumed that a load balancer
645+
implementation that matches the specified class is watching for Services.
646+
Any default load balancer implementation (for example, the one provided by
647+
the cloud provider) will ignore Services that have this field set.
648+
`spec.loadBalancerClass` can be set on a Service of type `LoadBalancer` only.
649+
Once set, it cannot be changed.
650+
The value of `spec.loadBalancerClass` must be a label-style identifier,
651+
with an optional prefix such as "`internal-vip`" or "`example.com/internal-vip`".
652+
Unprefixed names are reserved for end-users.
653+
You must enable the `ServiceLoadBalancerClass` feature gate to use this field.
654+
636655
#### Internal load balancer
637656

638657
In a mixed environment it is sometimes necessary to route traffic from Services inside the same

content/en/docs/reference/command-line-tools-reference/feature-gates.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ different Kubernetes components.
163163
| `ServerSideApply` | `false` | Alpha | 1.14 | 1.15 |
164164
| `ServerSideApply` | `true` | Beta | 1.16 | |
165165
| `ServiceLBNodePortControl` | `false` | Alpha | 1.20 | |
166+
| `ServiceLoadBalancerClass` | `false` | Alpha | 1.21 | |
166167
| `ServiceNodeExclusion` | `false` | Alpha | 1.8 | 1.18 |
167168
| `ServiceNodeExclusion` | `true` | Beta | 1.19 | |
168169
| `ServiceTopology` | `false` | Alpha | 1.17 | |
@@ -772,6 +773,7 @@ Each feature gate is designed for enabling/disabling a specific feature:
772773
- `ServiceAppProtocol`: Enables the `AppProtocol` field on Services and Endpoints.
773774
- `ServiceLBNodePortControl`: Enables the `spec.allocateLoadBalancerNodePorts`
774775
field on Services.
776+
- `ServiceLoadBalancerClass`: Enables the `LoadBalancerClass` field on Services. See [Specifying class of load balancer implementation](/docs/concepts/services-networking/service/#specifying-class-of-load-balancer-implementation-load-balancer-class) for more details.
775777
- `ServiceLoadBalancerFinalizer`: Enable finalizer protection for Service load balancers.
776778
- `ServiceNodeExclusion`: Enable the exclusion of nodes from load balancers
777779
created by a cloud provider. A node is eligible for exclusion if labelled with

0 commit comments

Comments
 (0)