We are facing an issue with session affinity when we increase the Replicas in the cluster; the problem is when we log in to the website, there is authentication. We are getting authentication many times at the time of login.
Here I explained why we are getting this issue and how we resolved this.
When using a single pod in the cluster, we don’t get any authentication error because when the user hits the website load-balancer, the traffic goes to that single replica. It will redirect to the authentication request, and it will succeed if the traffic hits a single pod.
In our case, when we increased the replica count, the application was not stable and asked for authentication multiple times and failed because the LB traffic was unable to select the right pod.
For this issue, we used to need some corrections in Ingress rules, so we added cookies-based-affinity is true in application gateway Ingress rules, and we can use Sticky sessions or session affinity also. We can give a time limit also for the session.
For this solution, we solved this issue, and traffic goes to both pods, and the session is saved.
A technology enthusiast passionate about automation, Gabriel Chutuape is a Cloud Engineer at ISmile Technologies. He’s part of the ISmile Technologies Cloud enablement team that help customers to design/solution/project engineering, integrating and implementing infrastructure technologies & services.
I’m working as Cloud DevOps Engineer. Expertise in technologies of Kubernetes, cloud services and cloud-native services, and DevOps technologies in various clouds.