docs: update README to clarify client IP preservation with Traefik and HelmChartConfig
This commit is contained in:
@@ -128,14 +128,31 @@ curl -si "http://<node-ip>/"
|
||||
|
||||
By default the app sees a cluster-internal address (for example `10.42.0.1`)
|
||||
instead of the real client IP, because the Traefik Service runs with
|
||||
`externalTrafficPolicy: Cluster`. To preserve the client IP, apply
|
||||
[k3s/traefik-config.yaml](k3s/traefik-config.yaml), which sets
|
||||
`externalTrafficPolicy: Local` on the Traefik Service:
|
||||
`externalTrafficPolicy: Cluster`. To preserve the client IP, set
|
||||
`externalTrafficPolicy: Local` on the Traefik Service through a
|
||||
`HelmChartConfig`, as in [k3s/traefik-config.yaml](k3s/traefik-config.yaml).
|
||||
|
||||
A cluster can hold only one `HelmChartConfig` named `traefik`, so first check
|
||||
whether one already exists:
|
||||
|
||||
```bash
|
||||
kubectl get helmchartconfig traefik -n kube-system
|
||||
```
|
||||
|
||||
If it does not exist, apply the file as is:
|
||||
|
||||
```bash
|
||||
kubectl apply -f k3s/traefik-config.yaml
|
||||
```
|
||||
|
||||
If it already exists, do not apply the file, as it would replace the existing
|
||||
Traefik settings. Instead, add `externalTrafficPolicy: Local` under the
|
||||
`service.spec` section of the existing `valuesContent`:
|
||||
|
||||
```bash
|
||||
kubectl edit helmchartconfig traefik -n kube-system
|
||||
```
|
||||
|
||||
#### Option 2: ServiceLB
|
||||
|
||||
k3s also includes the ServiceLB load balancer. The single `LoadBalancer`
|
||||
|
||||
Reference in New Issue
Block a user