Last active
July 27, 2022 00:03
Install the krew plugin for kubectl
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 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" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use like this: