Every time a new node comes online that meets constraints, I want to schedule 2x job tasks on that node. So something similar to a system job but with a count of 2. How can I achieve this with Nomad? And these nodes are always coming online/offline.
Or is the only way to achieve something close to this is go by resource constraints with a large count:
job "my-job" {
group "my-job" {
count = 10000
}
}
However this feels like it smells pretty bad since the UX will complain about a lot of unplaced tasks when I only have 5 nodes that these tasks can be scheduled on.
@brucellino Is that for achieving multiple tasks in a group? I am not sure if that will solve it for me since you can’t route a service to multiple tasks within a group based on what I’ve tested so far. Do you have an example?
No, I was thinking more along the lines of templating the whole thing, task and service. Unfortunately, I don’t have an example for you, I’m also only at the beginning of my Nomad Pack journey!
But if I understand correctly, you want to have a few jobs with associated service assigned to run on a newly registered node?
This feels like you need 2 system jobs, not one system job with count 2. Is the reason you’re not running N system jobs because it becomes unwieldy to manage the job spec, or something else?
If you do end up with unplaced tasks, this doesn’t surprise me - they will contend for resources of course, and not being able to place them all immediately sounds like a feature to me