Keep streamlit app running even if pods dies

I followed this tutorial and deployed a sample Streamlit app to local Kubernetes cluster (minikube). It all works fine, but in case a pod dies the users whose apps were connected to that pod gets an error message and have to refresh their pages to get the app working again (which also resets their state). Is there a way to keep their app running (with state maintained) without them knowing that the pod has died ?

Are there any best practices for deploying and horizontally scaling a Streamlit app specifically on Kubernetes ? I wonder how streamlit cloud does it

Hi @tushar_mit,

Thanks for sharing this question and sorry for the late reply.

Unfortunately, even with Streamlit Community Cloud, we don’t have a way to maintain session state after a pod dies, since session state is stored in memory on the pod and we don’t have a way to back that up. If the Community Cloud pod dies, corresponding apps would restart. We do hope to eventually improve this process / make it easier to maintain session state when a pod dies/restarts.

I wish I had a better answer for you!