omrish
November 30, 2025, 4:00pm
1
When trying to implement this solution:
opened 05:38PM - 15 Dec 23 UTC
kind/enhancement
area/documentation
priority/P2
area/provider/k8s
contributor/wanted
### Welcome!
- [X] Yes, I've searched similar issues on [GitHub](https://gith… ub.com/traefik/traefik/issues) and didn't find any.
- [X] Yes, I've searched similar issues on the [Traefik community forum](https://community.traefik.io) and didn't find any.
### What did you do?
# Context
We're using traefik in EKS and started using `nativeLB: true` in our `IngressRoute`s to fix 502 being returned when deploying.
# The problem
Since then we started to see that some pods were receiving WAY MORE traffic than others for the same deployment.
## Tests
Here are some tests we did on a deployment with 15 replica that were sent 10k requests using different configurations.
We used the following to perform the requests
```
seq 10000 | parallel 'curl -s "{URL}" -o /dev/null'
```
Requesting the k8s service (from inside the cluster) directly and completely bypassing traefik.
```
POD REQUESTS RECEIVED
POD-01 718
POD-02 695
POD-03 688
POD-04 680
POD-05 675
POD-06 673
POD-07 672
POD-08 664
POD-09 662
POD-10 652
POD-11 651
POD-12 650
POD-13 649
POD-14 639
POD-15 632
```
Requesting with `nativeLB: false` on the route's service
```
POD REQUESTS RECEIVED
POD-01 673
POD-02 671
POD-03 671
POD-04 670
POD-05 670
POD-06 670
POD-07 668
POD-08 667
POD-09 666
POD-10 665
POD-11 665
POD-12 664
POD-13 662
POD-14 662
POD-15 656
```
Requesting with `nativeLB: true` on the route's service
```
POD REQUESTS RECEIVED
POD-01 1517
POD-02 1348
POD-03 1230
POD-04 1097
POD-05 791
POD-06 631
POD-07 522
POD-08 501
POD-09 442
POD-10 441
POD-11 424
POD-12 402
POD-13 309
POD-14 204
POD-15 141
```
Calling with `nativeLB: true` on the route's service + custom server transport `ServersTransport -> maxIdleConnsPerHost: 0`
The idea was to try to force traefik to init a new connection on each request because k8s doesn't handle long lived connections well for load balancing. See https://learnk8s.io/kubernetes-long-lived-connections
```
POD REQUESTS RECEIVED
POD-01 1727
POD-02 1283
POD-03 1193
POD-04 869
POD-05 790
POD-06 532
POD-07 521
POD-08 514
POD-09 513
POD-10 478
POD-11 474
POD-12 454
POD-13 268
POD-14 234
POD-15 150
```
### What did you see instead?
As we can see from the tests, as soon as `nativeLB: true` is set the load balancing is broken.
### What version of Traefik are you using?
Version: 2.10.5
Codename: saintmarcelin
Go version: go1.21.3
Built: 2023-10-11T13:54:02Z
OS/Arch: linux/amd64
### What is your environment & configuration?
```
- args:
- --entrypoints.metrics.address=:9100/tcp
- --entrypoints.traefik.address=:9000/tcp
- --entrypoints.websecure.address=:8443/tcp
- --api.dashboard=true
- --ping=true
- --metrics.prometheus=true
- --metrics.prometheus.entrypoint=metrics
- --providers.kubernetescrd
- --providers.kubernetescrd.allowCrossNamespace=true
- --providers.kubernetescrd.allowExternalNameServices=true
- --entrypoints.websecure.http.middlewares=traefik-cdn-no-cache@kubernetescrd
- --entrypoints.websecure.http.tls=true
- --log.level=INFO
- --accesslog=true
- --accesslog.fields.defaultmode=keep
- --accesslog.fields.headers.defaultmode=drop
```
### If applicable, please paste the log output in DEBUG level
_No response_
To utilize NativeLB with maxIdleConnsPerHost=-1 I need to create a custom ServerTransport, but I’m using Gateway API with HTTPRoutes, I haven’t seen any place to use the custom ServerTransport in the HTTPRoute reference manifest.