Route multiple users to a specific Kubernetes pod based on the data they access

10/31/2019

I have multiple pods of the same app deployed using Kubernetes. The app manages multiple 'Project' objects. When Marry is working on 'Project 1' on pod-01, Tom logs on pod-02. Here is the requirement, if Tom tries to open 'Project 1' on pod-02, we need to route him to pod-01 where 'Project 1' is already open by Marry. How would I do that?

Can I store some unique identifier of pod-01 in the 'Project 1' object? So I can use it to route Tom to pod-01.

Is this technically feasible?

-- Shawn Pan
kubernetes

1 Answer

10/31/2019

What you are describing is stateful workload, where each instance of your application contain state.

Normal workload in Kubernetes is stateless and deployed with Deployment and ReplicaSet. However, Kubernetes now has some support for stateful workloads by using StatefulSet

It may be possible to implement your use case, but it depends. Your users will not have an instance for themself if that is what you need. I would recommend you to architect your service to be stateless workload, and store all state in a database (possibly with statefulSet) since it is much easier to handle stateless workloads.

-- Jonas
Source: StackOverflow