diff --git a/kubectx b/kubectx index 9d753c9..cfa7c00 100755 --- a/kubectx +++ b/kubectx @@ -159,6 +159,10 @@ delete_context() { } main() { + if ! hash kubectl 2>/dev/null; then + echo >&2 "kubectl is not installed" + exit 1 + fi if [[ "$#" -eq 0 ]]; then if [[ -t 1 && -z "${KUBECTX_IGNORE_FZF:-}" && "$(type fzf &>/dev/null; echo $?)" -eq 0 ]]; then choose_context_interactive diff --git a/kubens b/kubens index 3a5dc6f..c246b0f 100755 --- a/kubens +++ b/kubens @@ -156,6 +156,10 @@ swap_namespace() { } main() { + if ! hash kubectl 2>/dev/null; then + echo >&2 "kubectl is not installed" + exit 1 + fi if [[ "$#" -eq 0 ]]; then if [[ -t 1 && -z ${KUBECTX_IGNORE_FZF:-} && "$(type fzf &>/dev/null; echo $?)" -eq 0 ]]; then choose_namespace_interactive