I am working on kubernetes cluster. In my cluster i am having 3 namespaces.
Default
Staging
Production
At a time when i want to work on staging namespace.
In every kubectl command i have to pass namespace
kubectl get pods -n staging
kubectl get deployment -n staging
Is there any way to set active namespace at a time?
kubectl config set-context --current --namespace=<insert-namespace-name-here>
Refer here
Also you can use kubectx plugin
kubectl config set-context --current --namespace=<insert-namespace-name-here>
# Validate it
kubectl config view --minify | grep namespace: