Edith Puclla:
I realized something with context and namespaces, I am working in Minikube and I set the current context with the namespace dev2406, it was modified correctly. But That namespaces doesn’t exist. Minikube cannot identify if that namespace is non-existent
$ kubectl config set-context --current --namespace=dev2406
Context "minikube" modified.
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* minikube minikube minikube dev2406
Then:
$ k get namespace dev2406
Error from server (NotFound): namespaces "dev2406" not found
Tanumoy Ghosh:
When the question asks for particular namespace apart from default one, I used to run kubectl get ns <nsname>
to ensure about its existence even if the question guarantees that it is already created
Edith Puclla:
God point! I was curious … Thank you! :party_parrot:
chris resnik:
yes, namespaces don’t get created automagically
Madhan Kumar:
The set-context command just modifies your kube config.yaml file . Which you can also do manually by editing the file and updating the namespace for the context you need . So no validations…until you use that context which is when you get that error …
Madhan Kumar:
get-context command reads the file and displays whats in it …