Portainer Swarm node labels and CPU limits for a low-traffic stack: which constraint actually controls placement?
19K reputation · 16 Sept 2020, 16:05 UTC
I'm consolidating a low-traffic internal stack onto cheaper nodes in a Docker Swarm managed through Portainer. The plan is to label two small nodes (for example tier=low) and use placement constraints plus CPU/memory limits in the stack definition so these services never land on the larger nodes and never consume more than a fixed share of resources.
What I'm unsure about is how Portainer actually applies these settings when a stack is deployed through its UI or GitOps integration. Specifically, whether placement constraints defined in the compose file are preserved as-is, and whether the resource limits I set in Portainer's container/stack editor override or merge with what's in the compose file.
I'm also unclear on the failure behavior: if no node with the matching label has capacity, does the service stay pending, or does Swarm schedule it elsewhere?
My questions:
- When deploying a stack via Portainer, do compose-level
deploy.placement.constraintsanddeploy.resources.limitstake precedence over values set in the Portainer UI, or vice versa? - Is there a supported way in Portainer to verify which labels a node actually carries before scheduling, beyond the Swarm node list?
- Are these behaviors consistent across recent Portainer CE/BE versions, or should I pin my testing to a specific release?