Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
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 with kubectl v1.12 or later.

macOS/Linux {#posix}

Bash or ZSH shells {#bash}

  1. Make sure that git is installed.

  2. 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/')" &&
      curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/krew.tar.gz" &&
      tar zxvf krew.tar.gz &&
      KREW=./krew-"${OS}_${ARCH}" &&
      "$KREW" install krew
    )
  3. 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.

  4. Run kubectl krew to check the installation.

Fish shell {#fish}

  1. Make sure that git is installed.

  2. 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/') &&
      curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/krew.tar.gz" &&
      tar zxvf krew.tar.gz &&
      set KREWNAME krew-$OS"_"$ARCH &&
      ./$KREWNAME install krew &&
      set -e KREWNAME; set -e temp_dir
    end
  3. Add the $HOME/.krew/bin directory to your PATH environment variable. To do this, update your config.fish file and append the following line:

    set -gx PATH $PATH $HOME/.krew/bin

    and restart your shell.

  4. Run kubectl krew to check the installation.

Windows {#windows}

  1. Make sure git is installed.

  2. Download krew.exe from the Releases page to a directory.

  3. Launch a command prompt (cmd.exe) with administrator privileges (since the installation requires use of symbolic links) and navigate to that directory.

  4. Run the following command to install krew:

    krew install krew
  5. Add the %USERPROFILE%\.krew\bin directory to your PATH environment variable (how?)

  6. Launch a new command-line window.

  7. 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.