Kubectl Set Context -
Before running the command, your config might look like this:
When you run set-context , kubectl edits the ~/.kube/config file (by default).
kubectl config current-context
Organizing Cluster Access Using kubeconfig Files | Kubernetes
After running this, commands like kubectl get pods will automatically look in the monitoring namespace. kubectl set context
Tired of adding -n my-app to every command? You can bake the namespace into your context: kubectl config set-context --current --namespace=my-app Now, kubectl get pods will automatically look in my-app . 3. Modifying an Existing Context
kubectl config get-contexts
The basic structure of the command is: