Skip to content

NodePortLB support in kubernetes gateway provider#12175

Open
jorisvergeer wants to merge 6 commits intotraefik:masterfrom
jorisvergeer:nodeportlb_gateway_api
Open

NodePortLB support in kubernetes gateway provider#12175
jorisvergeer wants to merge 6 commits intotraefik:masterfrom
jorisvergeer:nodeportlb_gateway_api

Conversation

@jorisvergeer
Copy link
Contributor

@jorisvergeer jorisvergeer commented Oct 21, 2025

What does this PR do?

This PR adds NodePort Load Balancing capabilities to the kubernetes gateway provider. Similar to how this is implemented in kubernetes CRD provider and kubernetes Ingress provider.

Motivation

I run traefik outside my cluster on its own instance, because i have some services running outside Kubernetes and some inside.
Therefore back in the early days of traefik 2.10/3.0 I implemented NodePort loadbalancing #10278.

Now that the gateway api is widely available, i kind of prefer that way to defining routes. If only traefik supported NodePort load balancing in the gateway provider.... well... now it does.

More

  • Added/updated tests
  • Added/updated documentation

Additional Notes

After the #10278 PR there was an issue with RBAC to access node resources (Issue #10937). I updated the RBAC for the gateway api, added a note in the documentation migration page and added an option to disable the lookup of node resources altogether (disabling nodeport load balancing)

I understand the RBAC in k8s, but i don't know the full extent what the links are between each part RBAC role, binding and traefik. So, I'd like a second pair of eyes to have a look at this to not have the same or similar issue this time.

To consider

To mitigate the additional access to node resources, this feature might also be an opt in (providers.kubernetesgateway.enablenodeportlb), but this would be different than the other implementations of nodePort load balancing.

uniqAddresses := map[string]struct{}{}
var backendServers []backendAddress

for _, node := range nodes {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If externalTrafficPolicy is Local then you shouldn't include all nodes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is similar to #12023 and PR #12048, that has not been resolved/merged yet.
So unsure if that's a wanted feature.

@nmengin
Copy link
Contributor

nmengin commented Oct 23, 2025

Hey @jorisvergeer,

Thank you for your contribution.

We've set the status to "design-review" to allow us to check the PR and ensure there is no deep impact on Traefik before moving forward.

We'll keep you updated once the analysis is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants