Kubectl Use-context -

Use kubectl use-context instead.

use-context is faster, less error-prone, and keeps your original config intact. kubectl use-context

# List all available contexts kubectl config get-contexts kubectl config use-context my-prod-cluster Use kubectl use-context instead

This changes the current context only – it doesn’t merge or modify your kubeconfig file permanently. kubectl use-context

# Switch to dev environment kubectl config use-context dev-cluster kubectl get pods Switch back to prod kubectl config use-context prod-cluster

kubectl config rename-context old-name new-name

Set an alias for even faster switching: