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.
Session affinity uses cookies to track session information and potentially maintain login credentials. With session affinity, the application server that handles the first client request generates session information and places it in a Set-Cookie header in the response.
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.
Read this E-Book to get a pulse on Elasticsearch monitoring.
Are you monitoring your Elasticsearch environment to detect problems like unreliable nodes and out-of-memory errors? Know which metrics to monitor & where to start.
Cloud Engineer
Gabriel Chutuape
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.
CLOUD Engineer
Gopi Krishna
I’m working as Cloud DevOps Engineer. Expertise in technologies of Kubernetes, cloud services and cloud-native services, and DevOps technologies in various clouds.