I have set of tasks for given service t1, t2, ..., tk
across nodes N1, N2, ...Nw
.
Due to lower usage, I do not need as many tasks as k
.
I need only l
tasks (l < k
).
In fact, I do not need w
nodes so I want to start removing machines and pay less. Removing one machine at a time is fine.
Each service has its own state. The services are started in replicated mode.
1) How can I remove a single node and force the docker swarm not to recreate the same number of tasks for the service?
Notes:
- I can ensure that no work is rerouted to tasks running on a specific node, so removing the specific node is safe.
- This is the easiest solution, I will end up with
w - 1
nodes andl
services assuming that on the removed node was servedk - l
services.
or
2) How can I remove specific containers (tasks) from docker swarm and keep the number of replicas of the service lower by the number of removed tasks?
Notes:
- I assume that I already removed a node. The services from the node were redeployed to other nodes.
- I monitor myself the containers (tasks) which serve no traffic -> no state is needed to maintain
or
3) Any other solution?