Installing

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

macOS/Linux

Bash or ZSH shells

  1. Make sure that git is installed.

  2. Run this command in your terminal to download and install krew:

    (
      set -x; cd "$(mktemp -d)" &&
      curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/krew.{tar.gz,yaml}" &&
      tar zxvf krew.tar.gz &&
      KREW=./krew-"$(uname | tr '[:upper:]' '[:lower:]')_amd64" &&
      "$KREW" install --manifest=krew.yaml --archive=krew.tar.gz &&
      "$KREW" update
    )
    
  3. Add $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. Verify running kubectl krew works.

Fish shell

  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" &&
      curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/krew.{tar.gz,yaml}" &&
      tar zxvf krew.tar.gz &&
      set KREWNAME krew-(uname | tr '[:upper:]' '[:lower:]')_amd64 &&
      ./$KREWNAME install \
        --manifest=krew.yaml --archive=krew.tar.gz &&
      set -e KREWNAME; set -e temp_dir
    end
    
  3. Add $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. Verify running kubectl krew works.

Windows

  1. Make sure git is installed on your system.

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

  3. Launch a command-line window (cmd.exe) and navigate to that directory.

  4. Run the following command to install krew (pass the correct paths to krew.yaml and krew.zip below):

    krew install --manifest=krew.yaml
    
  5. Add %USERPROFILE%\.krew\bin directory to your PATH environment variable (how?)

  6. Launch a new command-line window.

  7. Verify running kubectl krew works.

Other package managers

You can alternatively install it via some OS-package managers like Homebrew (macOS).

However, we don’t actively support that scenario at the moment.

← User Guide