Last active
July 27, 2022 00:03
-
-
Save djw4/44c80cb14f8dd9b415f88290f97c4340 to your computer and use it in GitHub Desktop.
Install the krew plugin for kubectl
This file contains 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 characters
#!/usr/bin/env bash | |
set -eu | |
OS="$(uname | tr '[:upper:]' '[:lower:]')" | |
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" | |
KREW="krew-${OS}_${ARCH}" | |
TMP_DIR=$(mktemp -d) | |
pushd ${TMP_DIR} 1> /dev/null | |
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" | |
tar zxvf "${KREW}.tar.gz" | |
./"${KREW}" install krew | |
popd 1> /dev/null | |
echo -e '\nexport PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"' | tee -a $HOME/.bashrc | |
echo "alias krew=\"kubectl-krew\"" | tee -a $HOME/.bashrc | |
echo "Logout to refresh the bash profile" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use like this: