<p>I have my main application which has its own unique state, let's call it Application A.
This application A starts a few processes which does some parsing work and then it collects it and should send it to a database server outside of the Kuberentes cluster.</p>
<p>I would like to run a few copies of this application A in different pods. however, each instance is unique and cannot be replaced as it has its own state. it means that each client has to talk only with the same instance it started the communication with http requests.</p>
<ol>
<li>How can it be done in Kubernetes?</li>
<li>do I need to define <strong>StatefulSet</strong> component?</li>
<li>how do I manage that each client (from outside the cluster) will talk every time with the same instance he started communication on the same object id ? for example to get status on that object.</li>
<li>in case the pod die I don't want to recover. is that possible?</li>
</ol>

Ohad
<p>1: yes, sort of</p>
<p>2: not necessarily, but might simplify some things</p>
<p>3: if you use ingress, you can use different methods to maintain backend affinity ie. cookie based, source IP based etc. (nginx example: <a href="https://kubernetes.github.io/ingress-nginx/examples/affinity/cookie/" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/examples/affinity/cookie/</a>)</p>
<p>4: you might want to set restartPolicy to Never</p>
<p>With all that said, this really sounds like a bad idea. You should either allow shared state (ie. redis), or statefulset with ability to restart with the same state loaded from local storage. You need to remember that even with the most optimal setup things like this can break (ie. switch to different pod when a backing pod went down, node rescheduling due to cluster scaling etc.)</p>
