I'm new to Kubernetes and wondering, if there's a kubectl
command to figure out what namespace I'm currently working in?
Running the kubectl get ns
command prints out all the namespaces but doesn't show which one I'm in at present.
I'm new to Kubernetes and wondering, if there's a kubectl
command to figure out what namespace I'm currently working in?
Running the kubectl get ns
command prints out all the namespaces but doesn't show which one I'm in at present.
You want to inspect the local config for kubectl
and see current context. This shows your current context with namespace.
kubectl config get-contexts
Example output - can also be multiple clusters, but only one "current":
$kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* minikube minikube minikube default