Last active
February 19, 2019 19:38
-
-
Save eduardobaitello/9ff6e4e117d99e2c4c92203d743ebf95 to your computer and use it in GitHub Desktop.
.bashrc for "Using different kubectl versions with multiple Kubernetes clusters"
This file contains 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
# https://medium.com/@eduardobaitello/using-different-kubectl-versions-with-multiple-kubernetes-clusters-a3ad8707b87b | |
# Pssssst..Ubuntu here... | |
# Configuring kube_ps1 on PS1 | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(kube_ps1)\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(kube_ps1)\$ ' | |
fi | |
unset color_prompt force_color_prompt | |
# asdf Bash on Linux | |
# https://asdf-vm.com/#/core-manage-asdf-vm?id=add-to-your-shell | |
. $HOME/.asdf/asdf.sh | |
. $HOME/.asdf/completions/asdf.bash | |
# Make sure to not have any config file set at start | |
# However, kubectl will always use a | |
# $HOME/.kube/config file as default. Use this as a "dummy" file | |
unset KUBECONFIG | |
# kube_ps1 configs | |
# https://github.com/jonmosco/kube-ps1#customization | |
export KUBE_PS1_SYMBOL_ENABLE=false # I don't want symbols on my prompt | |
export KUBE_PS1_ENABLED=off # Start with kube_ps1 disabled | |
source $HOME/.local/bin/kube-ps1.sh # Source kube-ps1 script | |
# Configuring our three customers | |
# environments from Test Scenario | |
# Customer 1 | |
alias k8s_customer1='asdf global kubectl 1.10.11 && \ | |
asdf current && \ | |
export KUBECONFIG=$HOME/.kube/config_CUSTOMER_1 && kubeon' | |
# Customer 2 | |
alias k8s_customer2='asdf global kubectl 1.10.11 && \ | |
asdf current && \ | |
export KUBECONFIG=$HOME/.kube/config_CUSTOMER_2 && kubeon' | |
# Customer 3 | |
alias k8s_customer3='asdf global kubectl 1.12.3 && \ | |
asdf current && \ | |
export KUBECONFIG=$HOME/.kube/config_CUSTOMER_3 && kubeon' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment