kubectl config set-context --current --namespace=staging

Category: Kubernetes & Containers

kubectl config set-context --current --namespace=staging

Set the default namespace

Updates the current context so every kubectl command runs against the staging namespace unless you override with -n. This only changes your kubeconfig, not the cluster. Undo with the same command and --namespace=default.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.