Node Selector - Blogs
X

3

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.

4

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

Volume Management in Kubernetes

Since pods created in k8s are ephemeral, we are able to get the data as long as pods are alive, but ...

Read More >

Quick Understanding on Stateful Sets in Kubernetes

Stateful sets are similar to deployments, they can scale up and scale down, they can perform rolling...

Read More >

How to do Installation of K8S using kubeadm?

Till now I have given blogs on k8s objects, services, namespaces, ingress etc. but where to execute ...

Read More >

HOW TO DO BACKUP AND RESTORE ENTIRE K8S CLUSTER?

If you have deployed different applications on k8s cluster using various objects like deployments, p...

Read More >

Taints and Tolerations

Taints and tolerations are used to restrict the pods to schedule them onto respective nodes. There i...

Read More >

NODE AFFINITY

The k8s node affinity feature is to ensure pods are hosted on a particular node. As mentioned in pre...

Read More >

What is ingress and what are the components of it?

Ingress is a resource, which exposes the http and https from external sources to the services within...

Read More >

Kubernetes RBAC (Role Based Access Control)

The Kubernetes RBAC (role bases access control) system helps us in defining set of rules in controll...

Read More >

Namespaces in Kubernetes

A default namespace is created automatically when the cluster is being setup. To isolate or prevent ...

Read More >

Services and Blue-Green Deployment Strategy

In this article, we’ll briefly focus on services and blue-green deployment strategy.What is a servi...

Read More >

Share

Try DevOpSmartBoard Ultimate complete Azure DevOps End-to end reporting tool

Sign Up

  • Recent
  • Popular
  • Tag
Tags
Monthly Archive
Subscribe
Name

Text/HTML
Contact Us
  • *
  • *