How to make sure that after server restart, first pod goes to first node only and so on

Hi,
I am facing a challenge, where the scenario is after the server restarts, the first pod should be scheduled on the first node only, second pod on second node only and so on in a deployment. First node should not be scheduled on node other than the first.
please help.
Thanks in advacnce

A DaemonSet does something like this, although you might need to use a StatefulSet with pod anti-affinity if you want to enforce one-pod-per-node, and have different volumes to hold state.

1 Like

Pods deployed in a specific order is always StatefulSet. All the other apps/v1 kinds will deploy all the replicas at once.

DaemonSet guarantees one and only one pod per node for nodes matching its node selector, but it is an apps/v1 kind so the above applies.

Anti-affinity and topology spread constraints influence the scheduler’s node assignment decisions.

1 Like