From cb375a22e2d1fdc3b1c370429df4427faa155d8e Mon Sep 17 00:00:00 2001 From: Ben Jee Date: Thu, 28 May 2026 14:58:49 -0700 Subject: [PATCH] Update USP doc for routing to clusterIPs --- .../traffic-management/upstream-settings.md | 110 +++++++++++++++++- 1 file changed, 107 insertions(+), 3 deletions(-) diff --git a/content/ngf/traffic-management/upstream-settings.md b/content/ngf/traffic-management/upstream-settings.md index 23c53b567..0448909ff 100644 --- a/content/ngf/traffic-management/upstream-settings.md +++ b/content/ngf/traffic-management/upstream-settings.md @@ -299,7 +299,7 @@ spec: kind: Service name: tea loadBalancingMethod: "hash consistent" - hashMethodKey: "$upstream_addr" + hashMethodKey: "\$upstream_addr" EOF ``` @@ -357,6 +357,7 @@ upstream default_tea_80 { {{< call-out "note" >}} NGINX Open Source supports the following load-balancing methods: `round_robin`, `least_conn`, `ip_hash`, `hash`, `hash consistent`, `random`, `random two`, and `random two least_conn`. + NGINX Plus supports all of the methods available in NGINX Open Source, and adds the following methods: `random two least_time=header`, `random two least_time=last_byte`, `least_time header`, `least_time last_byte`, `least_time header inflight`, and `least_time last_byte inflight`. {{< /call-out >}} @@ -513,7 +514,7 @@ kubectl apply -f - < +``` + +{{< call-out "note" >}}This setting applies only when the target Service has a ClusterIP. For headless Services (ClusterIP: None) and ExternalName Services, normal endpoint resolution is used instead. Additionally, this setting is also not applied to L4/stream upstreams.{{< /call-out >}} + +View the IP address of the `coffee` Service and verify it matches the IP address in the `coffee` upstream: + +```shell +kubectl get service coffee +``` + +```text +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +coffee ClusterIP 10.96.23.26 80/TCP 16m +``` + + +```shell +kubectl exec -it deployments/gateway-nginx -- nginx -T +``` + +```text +upstream default_coffee_80 { + random two least_conn; + zone default_coffee_80 1m; + + + server 10.96.23.26:80; + keepalive 32; +} +``` + --- ## Further reading