Kubernetes 101 : Switching namespaces

Namespaces are Linux concept that helps isolate, processes, networking stacks, ... 

When we are in one namespace, we can't access the resources that "live" in other namespaces.

Within kubernetes we could have different namespaces, that hold different resources, or even different kubernetes clusters.

Namespaces in kubernetes are tied to a kubernetes object called context.

To switch to another namespace, we run the below command to change the current context:


All the following requests, or commands will be executed in the new namespace.

To go back to our default namespace in the current context, we use the below command:

Below is an example of the output of the above sub-command to get the name of the current context - combination of a username and a cluster name -:


Leave as a comment: