: The exact syntax is kubectl config use-context .
Manually typing long context names can be slow and prone to errors. Most Kubernetes administrators use external tools to make this process faster:
This guide should help you effectively manage multiple Kubernetes clusters and environments using kubectl contexts .
# Rename by creating a new one and deleting the old kubectl config set-context new-name --cluster=old-cluster --user=old-user kubectl config delete-context old-name
# Check available contexts first kubectl config get-contexts
kubectl config set-context my-prod-context \ --cluster=production-cluster \ --user=admin \ --namespace=default
or
: kubectl config current-context
