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

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

kubectl config rename-context old-name new-name kubectl use-context

It lets you instantly switch between clusters, namespaces, or users without editing config files.

kubectl config current-context Rename contexts for clarity: # Switch to dev environment kubectl config use-context

Use kubectl use-context instead.

Set an alias for even faster switching:

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