Kubectl Set-context May 2026

Context "staging" modified. Now, any kubectl get pods will automatically show pods in the backend namespace. This is non-destructive; you can always override it with -n frontend when needed. You don't have to be using a context to modify it. To change the default namespace for the development context (even if you are currently in production ):

kubectl get ns # Output shows resources in default namespace (or whatever is set) To change the default namespace for your current context to backend : kubectl set-context

export KUBECONFIG=~/.kube/config:~/secrets/gke-config kubectl set-context gke-prod --cluster=gke-prod --user=gke-user The command will update the first writable file in the list (usually the first one). kubectl set-context is deceptively simple. It does one small thing—modifying a field in a text file—but that small thing is the foundation of safe, efficient multi-cluster Kubernetes administration. Context "staging" modified