Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Label selector vs namespaces

It seems there is 2 ways to logically group pods, which are:

  • using labels to identifies organizational units in a loosely coupled fashion
  • creating namespaces

What are exactly the differences and use cases?

like image 430
Whimusical Avatar asked Nov 22 '17 18:11

Whimusical


Video Answer


1 Answers

Let's begin with a cluster which consists a number of nodes(Virtual Machines or Physical Machines ). Now We will divide our cluster in a logical way

Namespaces is a virtual cluster or a logical cluster. It helps us to organise projects or environments (development, testing, staging, and production environments). By using Namespaces, You can limit the quota to each namespace for resources utilization. You want to be sure that production environment has more than enough resources, so it won't starve to death.

Labels is a powerful concept in Kubernetes.It's a key-value pair which is assigned to kubernetes resources such as Pods, RepicaSet, Node etc. It is used to organise pods.for instance, ReplicaSet or Service can select the pods in a k8s cluster by using labels and perform an operation on them such as increasing the number of pods.

I have attached the link for further reading labels and Selector and Namespaces

like image 191
Suresh Vishnoi Avatar answered Oct 16 '22 18:10

Suresh Vishnoi