Subject
How can we implement subset hashing with F5 NGINX Ingress Controller?
Detailed Question
We are migrating from the community ingress-nginx controller to the F5 NGINX Ingress Controller.
Our existing setup uses the following community ingress-nginx annotations:
nginx.ingress.kubernetes.io/upstream-hash-by: $http_hs_id$arg_language
nginx.ingress.kubernetes.io/upstream-hash-by-subset: "true"
nginx.ingress.kubernetes.io/upstream-hash-by-subset-size: "5"
The requirement is:
-
The backend Service has multiple pods, for example, 5 pods.
-
Requests should be hashed using:
hs_id + language -
For each unique key, a stable subset of 3 pods should be selected.
-
Requests with the same key should continue using the same subset.
-
One pod from that subset should receive the request.
-
If the selected pod becomes unavailable, traffic should fail over to another healthy pod within the same subset.
-
NGINX response caching must continue to work.
-
Cache should be stored on persistent storage attached to the F5 NGINX Ingress Controller.
-
Cache keys should include request-specific values such as:
host + URI + hs_id + language
Current F5 Configuration
We are using an F5 NGINX VirtualServer similar to:
apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
name: playback-production-subset
namespace: f5-demo
spec:
host: example.com
ingressClassName: f5-demo-cache-nginx
upstreams:
- name: playback
service: playback-echo
port: 5678
lb-method: "hash $http_hs_id$arg_language"
routes:
- path: /
action:
pass: playback
The lb-method: hash provides consistent hashing to a single backend, but it does not appear to provide subset hashing.