Context [updated] - Kubectl Config Set

get_k8s_context() { echo "$(kubectl config current-context 2>/dev/null)" } PROMPT='$(get_k8s_context) $ '

# Unset the namespace override kubectl config set-context --current --namespace= That empty string removes the namespace pinning, reverting to the default namespace defined in the original context (usually default ). A fintech engineer once spent three hours debugging why a new pod wasn't appearing. He ran kubectl get pods repeatedly. Nothing. He restarted the deployment. Nothing. He yelled at the cloud provider. kubectl config set context

Add this to your ~/.zshrc or ~/.bashrc : Nothing

kubectl config set-context [NAME] --cluster=[CLUSTER] --user=[USER] --namespace=[NAMESPACE] Imagine you have a production cluster named prod-us-east and a user named prod-admin . You want a quick way to switch to the payment namespace. He yelled at the cloud provider

Because in the world of distributed systems, the most important cluster to control isn't the one in the cloud—it's the one inside your terminal.

The syntax is deceptively simple: