itsopensource

How to Switch Namespaces in Kubernetes

August 23, 2023

What is Namespace in Kubernetes?

In simple words, namespaces offer a means of segregating sets of resources within a unified cluster.

Changing Namespaces Using the kubectl Command

We can change namespace with using kubectl cli tool like:

kubectl config set-context --current --namespace=<new-namespace>

Verifying namespace change

With same kubectl tool we can verify easily with command:

kubectl config view --minify --output 'jsonpath={..namespace}'
Hope this helps 🙏🙏🙏

Shivam Singhal

Shivam Singhal is a full stack developer, Linux Guy, Mozillian by ❤️.
@idkhtml