Skip to content

Instantly share code, notes, and snippets.

@aaronkjones
Last active November 21, 2022 18:31
Show Gist options
  • Save aaronkjones/ca4fed7cc1c8cee74efd6e7879c14a34 to your computer and use it in GitHub Desktop.
Save aaronkjones/ca4fed7cc1c8cee74efd6e7879c14a34 to your computer and use it in GitHub Desktop.
Install specific version of kubectl

README

$ mkdir -P ~/.local/bin
$ wget https://gist.githubusercontent.com/aaronkjones/ca4fed7cc1c8cee74efd6e7879c14a34/raw/f5180810538593f54f0af4358e7b04566d48925f/install-kubectl.sh -O ~/.local/bin/install-kubectl.sh`
$ ~/.local/bin/install-kubectl.sh v1.21.14
#!/bin/bash
set -ex
if [ -z "$1" ]; then
CLI_VERSION="v1.21.14"
else
CLI_VERSION="$1"
fi
curl -LO "https://dl.k8s.io/release/$CLI_VERSION/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/release/$CLI_VERSION/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check && \
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
kubectl version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment