File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ alias switch='. /usr/local/bin/switch.sh'
3333alias check-k8s=' /usr/local/bin/check-k8s.sh'
3434alias get-minio-token=' kctx core-connectivity ; kubectl -n 60-minio-operator get secret $(kubectl -n 60-minio-operator get serviceaccount console-sa -o jsonpath="{.secrets[0].name}") -o jsonpath="{.data.token}" | base64 --decode'
3535alias k=' /usr/local/bin/kubectl'
36- alias kctx=' /usr/local/bin/kubectx'
36+ alias kctx=' unset KUBECONFIG ; /usr/local/bin/kubectx'
37+ alias kubectx=' unset KUBECONFIG ; /usr/local/bin/kubectx'
3738alias kns=' /usr/local/bin/kubens'
3839alias kube-editor=' . /usr/local/bin/kube-editor.sh'
3940alias k9s-mode=' . /usr/local/bin/k9s-mode.sh'
Original file line number Diff line number Diff line change @@ -45,5 +45,12 @@ if [ -f ${K9S_CONFIG_FILE} ] ; then
4545 done
4646fi
4747
48- # --- Run k9s binary (defaut is read-only mode)
49- k9s ${K9S_RUN_MODE}
48+ # --- Select current context to use for k9s session
49+ current_ctx=" $( kubectx -c) "
50+ export KUBECONFIG=" ${HOME} /.kube/${current_ctx} .yml"
51+ if [ -s ${KUBECONFIG} ] ; then
52+ # --- Run k9s binary (defaut is read-only mode)
53+ k9s ${K9S_RUN_MODE}
54+ else
55+ printf " \n%bERROR : k8s context \" ${KUBECONFIG} \" unknown.%b\n" " ${RED} " " ${STD} "
56+ fi
You can’t perform that action at this time.
0 commit comments