swarmkit icon indicating copy to clipboard operation
swarmkit copied to clipboard

Placement constraints

Open darkl0rd opened this issue 3 years ago • 3 comments

What I want to achieve:

Ensure replicas are spread across availability zones and never run in the same.

current approach:

I am currently doing this through placement preferences.

The problem:

However, they are that. Preferences. If one zone becomes unavailable, the other replica will be scheduled in the other zone which already contains a replica.

This is particularly troublesome, as the service is backed by persistent storage (ebs), which is not replicated across availability zones; meaning that the replica will start up with an empty volume in that zone.

Is it possible to set a placement preference similar to how constraints work? So that I can guarantee a (one) replica will always run in a distinct zone, if the other zone is not available then do not start the replica? If not, is there an alternative way of achieving this?

darkl0rd avatar May 18 '22 04:05 darkl0rd

Possible workaround: Use two services service_AZ1 and service_AZ2 that both have the same network alias and then route to the network alias?

s4ke avatar Jun 01 '22 08:06 s4ke

Thanks for the suggestion, this is what I ended up doing.

Curious though, is there any ongoing development on Swarmkit? Or is it (mostly) abandoned due to Kubernetes?

Sent from my iPhone

On 1 Jun 2022, at 10:02, Martin Braun @.***> wrote:

 Possible workaround: Use two services service_AZ1 and service_AZ2 that both have the same network alias and then route to the network alias?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

darkl0rd avatar Jun 02 '22 08:06 darkl0rd

However, they are that. Preferences. If one zone becomes unavailable, the other replica will be scheduled in the other zone which already contains a replica.

This is why I implemented --replicas-max-per-node couple of years ago. However it requires that requires to be combined with constraint in way that if you want only have one replica per zone then there can be only one possible node for it per zone.

Curious though, is there any ongoing development on Swarmkit? Or is it (mostly) abandoned due to Kubernetes?

Kubernetes has become industry standard so most of the developers are focusing to it. However there is still some development going on swarmkit side too time to time, depending how people are interested about it. I example just created one PR #3072 so it is interesting to see if that gets merged.

Issue about swarm roadmap can be found from #2665

olljanat avatar Aug 02 '22 21:08 olljanat