DEV Community

Cover image for #052 Kubernetes - Node Selector
Omar
Omar

Posted on • Edited on

3 2

#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.

Image of Quadratic

Free AI chart generator

Upload data, describe your vision, and get Python-powered, AI-generated charts instantly.

Try Quadratic free

Top comments (0)

Billboard image

Try REST API Generation for Snowflake

DevOps for Private APIs. Automate the building, securing, and documenting of internal/private REST APIs with built-in enterprise security on bare-metal, VMs, or containers.

  • Auto-generated live APIs mapped from Snowflake database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

👋 Kindness is contagious

Value this insightful article and join the thriving DEV Community. Developers of every skill level are encouraged to contribute and expand our collective knowledge.

A simple “thank you” can uplift someone’s spirits. Leave your appreciation in the comments!

On DEV, exchanging expertise lightens our path and reinforces our bonds. Enjoyed the read? A quick note of thanks to the author means a lot.

Okay