Kubectl Change — Current Context

func switchContext(config *clientcmdapi.Config, access clientcmd.ConfigAccess, name string) // 1. Safety Check if isDangerousContext(name) if !confirmAction("Switching to PRODUCTION. Continue?") return

After switching context, always check your namespace: kubectl change current context

kubectl config set-context --cluster= --user= --namespace= func switchContext(config *clientcmdapi

// 2. Switch Context config.CurrentContext = name func switchContext(config *clientcmdapi.Config

If you need to switch based on cluster region or tag: