Introduction

intro

this is part 48 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.


Namespaces

ns

namespace in general is logical separator used to make sure that process or in case of programming variables with same name are isolated by a logical name. In Kubernetes it is the same we use namespaces in large projects to divide a cluster into small isolated clusters using namespaces.


Lab

mad

the default Kubernetes is guess what? default. to get namespaces we type ns

kubectl get ns

ns is shortcut of namespaces. let's get the pods list po

kubectl get po

po is shortcut of pods to get the pods under default namespace nsd

kubectl get po -n default

-n is shortcut of --namespace.

it get all the pods because all my pods are in namespace. ns

kubectl create ns test-k

test-k is the namespace if i get the pods under this namespace tk

kubectl get po -n test-k

it's empty. That's is the use of it , now I can have sub clusters inside a cluster. also same as old way we can separate pods created using a yml file

kubectl create -f ex.yml -n tesk-k

or we can specify namespace inside the yml file himself.

This post is also available on DEV.