Last active
September 19, 2020 22:48
-
-
Save craigforr/f2af21e6dca74bd71c2e29c6b1e2640a to your computer and use it in GitHub Desktop.
Revisions
-
craigforr revised this gist
Sep 19, 2020 . 1 changed file with 12 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,18 @@ #!/usr/bin/env bash # Installs or upgrades kubectl on Linux # Chuck for root privileges if [[ "$EUID" != "0" ]] ; then echo "Please execute script with sudo or as root." exit 1 fi # Check Dependencies if ! curl --version &>/dev/null; then echo "curl must be installed and in \$PATH" exit 1 fi INSTALLED_KUBECTL_PATH=$(which kubectl 2>/dev/null || echo NONE) INSTALLED_KUBECTL_VERSION="$($INSTALLED_KUBECTL version --client --short | cut -f3 -d' ')" -
craigforr revised this gist
Sep 19, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Installs or upgrades kubectl on Linux INSTALLED_KUBECTL_PATH=$(which kubectl 2>/dev/null || echo NONE) INSTALLED_KUBECTL_VERSION="$($INSTALLED_KUBECTL version --client --short | cut -f3 -d' ')" LATEST_KUBECTL_VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt) @@ -19,7 +19,7 @@ fi if [ $DOWNLOADED_KUBECTL_VERSION != $LATEST_KUBECTL_VERSION ] ; then echo "ERROR: Something went wrong with the download." else mv ./kubectl $INSTALLED_KUBECTL_PATH echo "Installation and/or upgrade complete." fi -
craigforr created this gist
Sep 19, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/usr/bin/env bash # Installs or upgrades kubectl on Linux INSTALLED_KUBECTL=$(which kubectl 2>/dev/null || echo NONE) INSTALLED_KUBECTL_VERSION="$($INSTALLED_KUBECTL version --client --short | cut -f3 -d' ')" LATEST_KUBECTL_VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt) if [ $INSTALLED_KUBECTL_VERSION != $LATEST_KUBECTL_VERSION ] ; then curl -#LO "https://storage.googleapis.com/kubernetes-release/release/${LATEST_KUBECTL_VERSION}/bin/linux/amd64/kubectl" \ && chmod ug+x ./kubectl if [ -x ./kubectl ] ; then DOWNLOADED_KUBECTL_VERSION="$(./kubectl version --client --short | cut -f3 -d' ')" fi else echo "The latest version is already installed." fi if [ $DOWNLOADED_KUBECTL_VERSION != $LATEST_KUBECTL_VERSION ] ; then echo "ERROR: Something went wrong with the download." else mv ./kubectl $INSTALLED_KUBECTL echo "Installation and/or upgrade complete." fi # EOF