DEV Community

Cover image for #052 Kubernetes - Node Selector
Omar
Omar

Posted on • Updated on

#052 Kubernetes - Node Selector

Introduction

intro

this is part 52 from the journey it's a long journey(360 day) so go please check previous parts , and if you need to walk in the journey with me please make sure to follow because I may post more than once in 1 Day but surely I will post daily at least one 😍.

And I will cover lot of tools as we move on.


Node Selector

When we use Node Selector? let's say I need to use a Node that require lot of resources like ram and speed. So I need to put it inside a high performant Node. How we know that a Node had high performance? we specify it in the yml file.
node
we give set inside label performance with value of high . in the pod we use nodeSelector and performance high.
But here the Node is not secured because any pod can have it. That's the difference between taints and node selector.


Files for this lab

all the files can be found on the repository of this journey , if you already have it just pull if not clone it.
Files can be found here
high
this is the high performance called app_052.yml and low called app_053_low.yml , the difference here is that one have performance high and the other is low.


Lab

lab

first we need to label our Node as high performance
highNode

kubectl label nodes minikube performance=high
Enter fullscreen mode Exit fullscreen mode

second let's create our pod
c1

kubectl create -f app_052.yml
Enter fullscreen mode Exit fullscreen mode

now let's see the pods
getPo1

kubectl get pods
Enter fullscreen mode Exit fullscreen mode

c2

kubectl delete pods test-nodeselector
kubectl create -f app_052_low.yml
kubectl get pods
Enter fullscreen mode Exit fullscreen mode

first we deleted the old pod , then we create the new one with low performance . We can see that it's pending.

Top comments (0)