Document nativeLBByDefault annotation on Kubernetes Gateway provider

This commit is contained in:
Michel Loiseleur 2024-10-23 11:10:04 +02:00 committed by GitHub
parent f18fcf3688
commit 0605f8bf09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 51 additions and 0 deletions

View file

@ -304,6 +304,30 @@ providers:
--providers.kubernetesgateway.labelselector="app=traefik" --providers.kubernetesgateway.labelselector="app=traefik"
``` ```
### `nativeLBByDefault`
_Optional, Default: false_
Defines whether to use Native Kubernetes load-balancing mode by default.
For more information, please check out the `traefik.io/service.nativelb` [service annotation documentation](../routing/providers/kubernetes-gateway.md#native-load-balancing).
```yaml tab="File (YAML)"
providers:
kubernetesGateway:
nativeLBByDefault: true
# ...
```
```toml tab="File (TOML)"
[providers.kubernetesGateway]
nativeLBByDefault = true
# ...
```
```bash tab="CLI"
--providers.kubernetesgateway.nativeLBByDefault=true
```
### `throttleDuration` ### `throttleDuration`
_Optional, Default: 0_ _Optional, Default: 0_

View file

@ -723,4 +723,31 @@ X-Forwarded-Server: traefik-6b66d45748-ns8mt
X-Real-Ip: 10.42.2.1 X-Real-Ip: 10.42.2.1
``` ```
## Native Load Balancing
By default, Traefik sends the traffic directly to the pod IPs and reuses the established connections to the backends for performance purposes.
It is possible to override this behavior and configure Traefik to send the traffic to the service IP.
The Kubernetes service itself does the load balancing to the pods.
It can be done with the annotation `traefik.io/service.nativelb` on the backend `Service`.
By default, NativeLB is `false`.
!!! info "Default value"
Note that it is possible to override the default value by using the option [`nativeLBByDefault`](../../providers/kubernetes-gateway.md#nativelbbydefault) at the provider level.
```yaml
---
apiVersion: v1
kind: Service
metadata:
name: myservice
namespace: default
annotations:
traefik.io/service.nativelb: "true"
spec:
[...]
```
{!traefik-for-business-applications.md!} {!traefik-for-business-applications.md!}