kubernetes / ingress-nginx

Ingress-NGINX Controller for Kubernetes
https://kubernetes.github.io/ingress-nginx/
Apache License 2.0
16.99k stars 8.15k forks source link

Support `internalTrafficPolicy: Local` for upstream services without `service-upstream` annotation #11564

Open AleksaC opened 1 week ago

AleksaC commented 1 week ago

By default the ingress nginx uses all endpoints of a service in the upstream configuration. This has benefits like allowing proxy_next_upstream to be used, having more even request distribution to upstreams as well as not using conntrack.

However in some cases it is beneficial to avoid traffic between nodes, which can be achived by setting internalTrafficPolicy: Local. In this case it would be useful if ingress nginx only added node-local endpoints to the upstream configuration, avoiding cross-node traffic to the service without having to use service-upstream annotation.

This behavior can be controlled by a flag similar to EnableTopologyAwareRouting that's already supported by ingress nginx.

k8s-ci-robot commented 1 week ago

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
strongjz commented 2 days ago

Then why not just use EnableTopologyAwareRouting ?

AleksaC commented 2 days ago

I did that, however in this case I'd prefer if there was no traffic between the nodes, even in the same AZ. Also it seems that EndpointSlice controller falls back to cluster-wide routing if there is a small number of endpoints per zone.