<p>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? </p>

<p>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.</p>

<p>Is this technically feasible?</p>

Shawn Pan
<p>What you are describing is <strong>stateful</strong> workload, where each instance of your application contain <em>state</em>. </p>

<p><em>Normal</em> workload in Kubernetes is <strong>stateless</strong> and deployed with <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="nofollow noreferrer">Deployment</a> and <a href="https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/" rel="nofollow noreferrer">ReplicaSet</a>. However, Kubernetes now has <em>some</em> support for <strong>stateful</strong> workloads by using <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="nofollow noreferrer">StatefulSet</a></p>

<p>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 <strong>stateless</strong> workload, and store all state in a database (possibly with statefulSet) since it is much easier to handle stateless workloads.</p>
