<p>I have an app which using in memory database. I created statefulset using the Pod with let's say 3 replica. used PVC for storing the database related files.</p>

<p>I used a Loabalancer to expose the statefulset.</p>

<p>So when the traffic hits loadbalancer each time it's forwarded to different pods. </p>

<p>Is there anyway I can control the loadbalacing to the Pod based on some condition ( like if Client IP is X go to pod Y) ?</p>

<p>The very fact that you have a leader/follower topology, the ask to direct traffic to a said nome (master node) is flawed for a couple of reasons:</p>

<ol>
<li>What happens when the current leader fails over and there is a new
election to select a new leader </li>
<li>The fact that pods are ephemeral
they should not have major roles to play in production, instead work
with deployments and their replicas. What you are trying to achieve
is an anti-pattern</li>
</ol>

<p>In any case, if this is what you want, maybe you want to read about <code>gateways in istio</code> which can be found <a href="https://istio.io/docs/tasks/traffic-management/ingress/#determining-the-ingress-ip-and-ports" rel="nofollow noreferrer">here</a></p>
