title | slug | weight |
---|---|---|
Installing |
install |
200 |
Krew itself is a kubectl
plugin that is installed and updated via Krew (yes,
Krew self-hosts).
⚠️ Warning: krew is only compatible withkubectl
v1.12 or later.
macOS/Linux {#posix}
Bash or ZSH shells {#bash}
-
Make sure that
git
is installed. -
Run this command to download and install
krew
:( set -x; cd "$(mktemp -d)" && 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}" && curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" && tar zxvf "${KREW}.tar.gz" && ./"${KREW}" install krew )
-
Add the
$HOME/.krew/bin
directory to your PATH environment variable. To do this, update your.bashrc
or.zshrc
file and append the following line:export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
and restart your shell.
-
Run
kubectl krew
to check the installation.
Fish shell {#fish}
-
Make sure that
git
is installed. -
Run this command in your terminal to download and install
krew
:begin set -x; set temp_dir (mktemp -d); cd "$temp_dir" && set OS (uname | tr '[:upper:]' '[:lower:]') && set ARCH (uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/') && set KREW krew-$OS"_"$ARCH && curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/$KREW.tar.gz" && tar zxvf $KREW.tar.gz && ./$KREW install krew && set -e KREW temp_dir && cd - end
-
Add the
$HOME/.krew/bin
directory to your PATH environment variable. To do this, update yourconfig.fish
file and append the following line:set -gx PATH $PATH $HOME/.krew/bin
and restart your shell.
-
Run
kubectl krew
to check the installation.
Windows {#windows}
-
Make sure
git
is installed. -
Download
krew.exe
from the Releases page to a directory. -
Launch a command prompt (
cmd.exe
) with administrator privileges (since the installation requires use of symbolic links) and navigate to that directory. -
Run the following command to install krew:
.\krew install krew
-
Add the
%USERPROFILE%\.krew\bin
directory to yourPATH
environment variable (how?) -
Launch a new command-line window.
-
Run
kubectl krew
to check the installation.
Other package managers
You can alternatively install Krew via some OS-package managers like Homebrew (macOS).
However, that method is not actively supported at this time.