Kubernetes Multi-Pod Session Handling

0
Hi CommunityI just have a question We are running a Mendix app on Kubernetes with 3 replicas. Occasionally users get logged out or lose their session mid-workflow. We have configured a standard ingress without sticky sessions. Is Mendix runtime stateful by nature, and what is the correct way to handle session persistence in a multi-pod setup?
asked
1 answers
1

Hi Rakesh


Yes, Mendix runtime is stateful by default sessions are stored in-memory on the pod that handled the login. If a subsequent request is routed to a different pod, the session won't be found and the user gets redirected to login. and more over what you had declared if the solution because sticky session will solve this problem if you setup that in ingress level of your web server.


Enable sticky sessions (session affinity) at the ingress level:

nginx.ingress.kubernetes.io/affinity: "cookie"

nginx.ingress.kubernetes.io/session-cookie-name: "SERVERID"

nginx.ingress.kubernetes.io/session-cookie-expires: "172800"


Another option if you no need to do this is little tricky , configure an external Redis session store via com.mendix.core.SessionStorage custom runtime setting to store and resolve.


I hope this helps

answered