In my previous two articles I demonstrated how to create new namespaces with quotas. However, someone asked is it possible to switch to the new namespace instead of always being in the default namespace. Yes, yes you can.
My previous two articles:
As you can see when I issue the get pods commands it returns me the default namespaces information.
As you can see when I issue it against the desired namespace I get the information I am looking for.
How to switch namespaces you are in.
$ kubectl config set-context $(kubectl config current-context) –namespace=<namespace>
This command will switch you over to the other namespace and as you can see from running just the get pods command I am able to see the 3 I was expecting.
Switch back to default
$ kubectl config set-context $(kubectl config current-context) –namespace=default
As you can see I am back in default
Not much to say here because this was a simple one. As always, I hope y’all found this helpful.