Specify max number of replicas per node for a service

I need to ensure that the 3 replicas of my service run on separate nodes (for HA since my service can only tolerate one node shutting down/failing at a time).

How can I do this using 1.12 swarm mode cluster?

If I can’t do this in 1.12, I would like to request that a new feature be added for 1.13 allowing this.

One possible method to support this is to add a new option called --max-replicas-per-node=<n> where <n> is a positive integer. If --max-replicas-per-node=1, then each task of the service will be guaranteed to run on separate nodes.

1 Like