We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c8d08a5 commit 257d77aCopy full SHA for 257d77a
tools/scripts/check-k8s.sh
@@ -60,6 +60,7 @@ checkClusterResources() {
60
#--- Check k8s cluster status
61
#===================================================================================
62
unset https_proxy http_proxy no_proxy
63
+current_context="$(kubectx -c 2> /dev/null)"
64
export KUBECONFIG="${HOME}/.kube/config"
65
contexts="$(kubectl config view -o json | jq -r ".contexts[].name")"
66
display_contexts="$(echo "${contexts}" | sort | pr -3t -W 130)"
@@ -83,3 +84,8 @@ if [ "${context}" = "" ] ; then
83
84
else
85
checkClusterResources "${context}"
86
fi
87
+
88
+#--- Set inital context
89
+if [ "${current_context}" != "" ] ; then
90
+ kubectx ${current_context} > /dev/null 2>&1
91
+fi
0 commit comments