This report and script should give you a solid starting point for understanding and managing your kubectl context.
To view all available contexts, use the kubectl config get-contexts command:
kubectl config view --context=$(kubectl config current-context) kubectl context
You’ve been looking at the development cluster the whole time, not staging. The pods in dev are fine because no one’s using them for real testing. Staging is on fire, but you’ve been staring at the wrong fireplace.
kubectl config current-context
Managing multiple clusters and namespaces is a daily reality for most Kubernetes operators. At the heart of this workflow is the , a configuration element that allows you to seamlessly switch your command-line focus between different environments. What is a Kubernetes Context?
Now you’ll see something like [alex@laptop dev-cluster] $ — no more guessing. This report and script should give you a
export PS1="[\u@\h \$(kubectl config current-context)] \$ "
You nod, stay in the same terminal, and run: Staging is on fire, but you’ve been staring
To see all available contexts defined in your kubeconfig file (usually located at ~/.kube/config ), run: kubectl config get-contexts