Loadbalancing in kubernetes issues (cookie help?)

Hi, I’m trying to deploy a streamlit app in a kubernetes environment. It works fine when there is one replica serving the app, but if I scale out so that there are several replicas, the app does not display properly - some of the graphs, etc, do not show in the browser (they are replaced by a β€˜0’ character).

My current asumption is that this is happening because the requests from a user’s browser are being distributed round-robin among the pods, and that streamlit is websocket based and needs sticky sessions enabled.

If this sounds like the right cause, then I need to find a way of introducing session affinity, so I can route all request from a user to the same pod. However, the nature of our setup is that I don’t have access to the IP of the user. So, either I need to be able to identify users by a cookie or a http header.

Does streamlit set a session cookie I can use for this purpose?

1 Like

I have a similar scenario and raised this feature request: