I have a StatefulSet with several replicas, for example 3 and multiple kubernetes Node in two zones.
I want to place the FIRST replica in the selected zone and the rest in the others zones.
Why the first one? Each pod is a database instance. Replication is configured between them. And by default the first node is master.
So I want to be able to influence where the first node is installed.
This is not supported in StatefulSet
, as the Pod-template is identical for each replica.
You might be able to achieve this by writing a custom scheduler. For inspiration, see this article for a custom scheduler for CockroachDB: A Custom Kubernetes Scheduler to Orchestrate Highly Available Applications