How to make sure that only one service is deployed to specific node


We have nomad cluster with 3 nodes, and we have one special service which needs 60GBs to run.

In total we have about 20+ services, 29 of them have very small memory needs (300 mb or less).

Problem we are having is that we have one client with 128GB, and it can run 2 copies of big service, and 2 smaller clients (16GB and 8GB) which are running other services.

Sometimes we get problem that smaller services get deployed to big client, and after that we don’t have 2x60GB free to deploy 2 instances of big service.

We know we can use affinity/constraint but that means putting logic in every nomad file not to deploy to big client, and we would like to avoid that.

At moment we are testing preemption and job priority but looks like it wont work :slight_smile:

I was wondering if any has suggestions or experiences how to solve this.

Hi @VladimirZD. Thanks for using Nomad!

How about making it a system job? These run one instance per node that meets the constraint.

We don’t want to have instance on every client.
We need that job A runs only on client A1, and all other jobs run on any other client but A1.

Setting it as system won’t solve that, we would get instance on every client which has enough resources

Hi @VladimirZD , when you say preemption / job priority don’t work, what issue are you seeing?

Got taken by other bit more important stuff, but i was hoping preemption would work in the way it will kill “less important” jobs deploy more important one and then deploy “Less important” to nodes which have enough resources free.

In that way it would make room on big hosts to deploy mem hungry service.
Didn’t test it fully so at moment i am not sure if it will work in that way, will send update after i tried

Just quick update, after testing we are ok with preemption, it will stop jobs and make place for big one.

Thnx for help