Excluding host by default

I wonder if in rancher there is a way to not schedule any container to a host unless the label of scheduling a container to a host exists

The usecase I think of is to have separate host pools on the same environment, each pool will have different properties that fit to different services.
For example
A general pool for everything except the following

  1. A pool for elasticsearch
  2. A pool for memory intensive workers
    3 a pool for metric infra such as elk and influxdb


Thanks, Guy

Currently not, there is an open issue in Github about this. For now only option is to setup scheduling rules to all service (not include label). I use it for balancers, as we host this services on separate servers, using simple host label balancer=true and all services except balancer has setup “must not balancer=true”. Stupid but works.

1 Like

Hi @guydou,

Rancher does allow you to schedule containers based on the labels present or not present on the host.

When you create or upgrade a service there will be a “Scheduling” tab at the bottom where you can add scheduling rules. For example you can say “The host must have a host label of elasticsearch=true” and the container will only spawn on hosts that are meant for elasticsearch. However, this will not stop other containers from running on your elasticsearch hosts. To accomplish that you would need to have all of your general purpose services scheduled “The host must have a host label of generalpurpose=true” or something along those lines.

Another Option:

This may not help your current use case, but Rancher also allows you to set resource reservation for RAM and CPU so that you can make sure you only assign containers to hosts that can support the application. You can find these settings in the “Security/Host” tab of the service upgrade/create page. Note: The measurement for CPU reservation is in mCPUs or thousandths of a CPU. The “mCPU” thing confused me at first. :wink:

Hope this helps!

1 Like