'Python Flask session for multiple instances
How can I make a flask session work across multiple instances of containers using Kubernetes? Or does Kubernetes always maintain the same container for a given session?
Solution 1:[1]
Default Flask sessions are stored client-side (in the browser) as a cookie and cryptographically signed to prevent tampering. Every request to your Flask application is accompanied by this cookie. Therefore, if all running containers have the same app (at least the same secret key used for signing), then they should all have access to the same session data.
Note:
- This is cryptographically signed, but it is not encrypted, so don't store sensitive information in the session
- Flask-Session can be installed for server-side session support
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Brandon Fuerst |
