Kubectl Switch Contexts [hot] May 2026
He looked at his terminal prompt. His shell was configured to show the current Kubernetes context in green. But today, it was… red .
# Show k8s context in prompt export PS1='\[\e[33m\](k8s: $(kubectl config current-context 2>/dev/null))\[\e[0m\] \w \$ ' He also created an alias he’d never forget: kubectl switch contexts
He closed his laptop, leaned back, and stared at the ceiling. He looked at his terminal prompt
kubectl config use-context prod-us-east Switched to context "prod-us-east". kubectl switch contexts
But Alex never forgot that feeling. The cold realization that you’re looking at a mirror image of the problem, not the problem itself.
“Then why is the alert firing?” he whispered.
Alex rubbed his eyes and stared at the terminal. The on-call alert was screaming: