Namespaces

View saved

Default space

Many objects live in the default namespace unless you specify another.

kubectl get namespaces
kubectl get pods -n default

Create a learning namespace

Isolate practice apps from other work.

kubectl create namespace learning
kubectl create deployment demo --image=nginx:1.27 -n learning
kubectl get all -n learning

Set a default namespace for your context

Optional convenience while studying.

kubectl config set-context --current --namespace=learning

What namespaces are not

They are not full security walls by themselves. They organize and scope names; policies and RBAC add real isolation in shared clusters.

Comments

One comment per signed-in account. Comments are saved with this page’s URL.