<p>I have a StatefulSet with several replicas, for example 3 and multiple kubernetes Node in two zones.</p>
<p>I want to place the <strong>FIRST</strong> replica in the selected zone and the rest in the others zones.</p>
<ul>
<li>mysts-0-0 &lt; <strong>main_zone</strong></li>
<li>mysts-0-1 &lt; back_zone</li>
<li>mysts-0-2 &lt; back_zone</li>
</ul>
<p>Why the first one? Each pod is a database instance. Replication is configured between them. And by default the first node is master.</p>
<p>So I want to be able to influence where the first node is installed.</p>

jesmart
<p>This is not supported in <code>StatefulSet</code>, as the Pod-template is identical for each replica.</p>
<p>You might be able to achieve this by writing a custom scheduler. For inspiration, see this article for a custom scheduler for CockroachDB: <a href="https://kubernetes.io/blog/2020/12/21/writing-crl-scheduler/" rel="nofollow noreferrer">A Custom Kubernetes Scheduler to Orchestrate Highly Available Applications</a></p>
