jonmosco / kube-ps1

Kubernetes prompt info for bash and zsh
Apache License 2.0
3.52k stars 351 forks source link

display context name #169

Closed Benjie-legit closed 1 year ago

Benjie-legit commented 1 year ago

Im using the same cluster name (e.g example-cluster) across my different env's (staging, prod) but the context names are different.

How ca I configure kube-ps1 to display the context name and not the cluster name?

currently it displays the same name for all env's, and its not helping at all

jonmosco commented 1 year ago

kube-ps1 does use the context name, not the cluster name: KUBE_PS1_CONTEXT="$(${KUBE_PS1_BINARY} config current-context 2>/dev/null)"

You can set aliases in your kubeconfig file to organize the names, example: kubectl config rename-context $(kubectl config current-context) test-alias

jonmosco commented 1 year ago

Closing this issue. Solution above should provide necessary data on the prompt.