
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.
- Node Selector
- 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.
Related
Since pods created in k8s are ephemeral, we are able to get the data as long as pods are alive, but ...
Read More >
Stateful sets are similar to deployments, they can scale up and scale down, they can perform rolling...
Read More >
Till now I have given blogs on k8s objects, services, namespaces, ingress etc. but where to execute ...
Read More >
If you have deployed different applications on k8s cluster using various objects like deployments, p...
Read More >
Taints and tolerations are used to restrict the pods to schedule them onto respective nodes. There i...
Read More >
The k8s node affinity feature is to ensure pods are hosted on a particular node. As mentioned in pre...
Read More >
Ingress is a resource, which exposes the http and https from external sources to the services within...
Read More >
The Kubernetes RBAC (role bases access control) system helps us in defining set of rules in controll...
Read More >
A default namespace is created automatically when the cluster is being setup. To isolate or prevent ...
Read More >
In this article, we’ll briefly focus on services and blue-green deployment strategy.What is a servi...
Read More >
Share