Canarys | IT Services


Node Selector



Assume you have 3 nodes cluster of which two of them are having lower hardware resources and one of them is larger node configured with higher resources, and there are different kinds of workloads running in our cluster, and you would like to dedicate data-processing workloads that require higher horse power to the larger nodes , as that is the only node that will not run out of resources in case job demands extra resources.

In current default setup pods can go into any nodes, so pod c in this case may end up on node2 or node 3 which is not desired, to solve this we can set a limitation on pods. So, that they run on only particular nodes. There are 2 ways to do it.

  1. Node Selector
  2. Node Affinity

To schedule a pod into the desired node, we should add some values in pod definition file under spec as follows.


The size: large is the key value pair for the node, for that we need to label the node 1st which I have already given in my previous blog as well refer that too


 #kubectl label nodes node-name label-key=label-value 

In this case

 #kubectl label nodes node-1 size=Large 

Even though we are able to solve this,There are certain limitations of node Selector; Since we used single label to achieve our goal here, but what if our requirement is more complex like place a pod in large or medium node, place a pod that are not small. You cannot achieve this with node selector. For that we have another feature called NODE AFFINITY, will see that in my next blog.

Leave a Reply

Your email address will not be published. Required fields are marked *

Reach Us

With Canarys,
Let’s Plan. Grow. Strive. Succeed.