I am using Kong ingress controller on EKS.
NLB → Kong ingress controller and proxy(running in the same pod) → k8s service → backend pods
I am trying to achieve stickiness using hash_on cookies configuration on upstream.
I am using session and hmac_auth plugin for generating session/cookie.
1st request from the client: First time when the client sends a message to the NLB, NLB sends the traffic to Kong ingress controller and from there it’s goes to one of the backend pods. This is the first time and so Kong will generate a cookie and send it back in the response to the client.
In the log I see this: 2023/02/04 10:02:03 [debug] 1127#0: *2575 [kong] access.lua:73 [session] session not present 2023/02/04 10:02:03 [debug] 1127#0: *2575 [lua] consistent_hashing.lua:136: getPeer(): trying to get peer with value to hash: [cf36df2f-077e-430c-80a0-d99f3e75d6de]
2nd request from the client: Now second time when client is sending the request it is including the cookie as well it got from the response of 1st request. Now when the request comes to Kong it may or may not forward the request to the same pod it forwarded the first time.
But on 3rd, 4th…nth request Kong is forwarding the request to the same pod it forwarded to in the 2nd request.
My expectation was first time when Kong receives a request from a client it will generate a Cookie and it will put some detail specific to the pod it is sending traffic to and next time whenever the same client sends a request it will send the cookie with it, kong should use the cookie and forward the request to the same pod it forwarded the first time…but this is not happening…I am getting stickiness after 2nd to nth request but not for the 1st request.