Created
April 17, 2019 15:03
-
-
Save dracorp/060794d005a66eb12b5ef1bd473aa2e0 to your computer and use it in GitHub Desktop.
Put this file into ~/.bash-it/custom/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function k8s_context_prompt { | |
local kube_namespace | |
kube_namespace="$(kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)" | |
# Set namespace to 'default' if it is not defined | |
kube_namespace="${kube_namespace:-default}" | |
echo -e "$(kubectl config current-context):${kube_namespace}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To enable kubectl current context in your prompt add to POWERLINE_PROMPT variable value: k8s_context.