Kubectl Switch Contexts _best_ 〈Bonus Inside〉

“Gotcha.”

Twenty minutes later, Alex had rolled back the deployment, adjusted the Redis maxclients setting, and re-deployed the fix. Latency returned to normal. The alert cleared.

kubectl get pods -n payment-system Pods were crashing. CrashLoopBackOff. Restart counts through the roof.

alias kctx='kubectl config get-contexts -o name | fzf | xargs kubectl config use-context' Finally, he wrote a quick script for the team’s shared tooling: kubectl-warning.sh . It would flash a bright red warning if the context was anything other than prod-us-east and the --namespace flag was missing or set to default .

He switched contexts immediately: