How to Install Krew Plugin Manager for Kubectl CLI on Linux


In this article, we will see how to install Krew Plugin Manager for Kubectl CLI tool on Linux. Krew is a free and open source plugin manager for kubectl command line tool. It is used for installing and managing kubectl plugins in our local system. It helps us discover wide variety of plugins to enhance our kubernetes experience. Till date, there are around 212 kubectl plugins distributed on krew. It is also very easy install on Windows, Mac and Linux based systems. Here we will see the steps to install krew plugin manager on Linux distributions.


How to Install Krew Plugin Manager for Kubectl CLI on Linux

How to Install Krew Plugin Manager for Kubectl CLI on Linux

Also Read: Solved "E: Unable to fetch some archives, maybe run apt-get update"

Step 1: Prerequisites

a) You should have a running Linux Server.

b) You should have sudo or root access to run privileged commands.

c) You should have kubectl, git and curl utility installed in your System.


Step 2: Update Your Server

If you are using Ubuntu/Debian based linux distribution then in the first step, you need to update your package cache and upgrade all the packages to the latest version by using sudo apt update && sudo apt upgrade command as shown below.

cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade

If you are using RHEL/CentOS based systems, then you need to use either sudo yum update && sudo yum upgrade or sudo dnf update && sudo dnf upgrade command to install all the latest available updates in your system.


Step 3: Install Krew Plugin Manager

You need to go to official website and get the latest commands to download and install Krew Plugin manager on your linux system. In our case, we have saved the command in file as shown below.

cyberithub@ubuntu:~$ nano
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 "${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew

Then to run the file, you need to give execute permission using chmod command as shown below.

cyberithub@ubuntu:~$ chmod +x

Finally, to install krew plugin manager, you need to run the executable file by using ./ as shown below.

cyberithub@ubuntu:~$ ./
+++ mktemp -d
++ cd /tmp/tmp.42BBgHdbBZ
+++ tr '[:upper:]' '[:lower:]'
+++ uname
++ OS=linux
+++ sed -e s/x86_64/amd64/ -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/'
+++ uname -m
++ ARCH=amd64
++ KREW=krew-linux_amd64
++ curl -fsSLO
++ tar zxvf krew-linux_amd64.tar.gz
++ ./krew-linux_amd64 install krew
Adding "default" plugin index from
Updated the local copy of plugin index.
Installing plugin: krew
Installed plugin: krew
| Use this plugin:
| kubectl krew
| Documentation:
| Caveats:
| \
| | krew is now installed! To start using kubectl plugins, you need to add
| | krew's installation directory to your PATH:
| |
| | * macOS/Linux:
| | - Add the following to your ~/.bashrc or ~/.zshrc:
| | export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
| | - Restart your shell.
| |
| | * Windows: Add %USERPROFILE%\.krew\bin to your PATH environment variable
| |
| | To list krew commands and to get help, run:
| | $ kubectl krew
| | For a full list of available plugins, run:
| | $ kubectl krew search
| |
| | You can find documentation at
| |
| /


Step 4: Set PATH Environment Variable

In the next step, you need to add the $HOME/.krew/bin directory to your PATH environment variable as shown below. But this is just the temporary way to add. To make it permanent, add the path into ~/.profile or ~/.bashrc file and restart the login shell.

cyberithub@ubuntu:~$ export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"


Step 5: Verify Installation

After successful installation, you can verify the plugin manager by using kubectl krew command as shown below.

cyberithub@ubuntu:~$ kubectl krew
krew is the kubectl plugin manager.
You can invoke krew through kubectl: "kubectl krew [command]..."

kubectl krew [command]

Available Commands:
completion generate the autocompletion script for the specified shell
help Help about any command
index Manage custom plugin indexes
info Show information about an available plugin
install Install kubectl plugins
list List installed kubectl plugins
search Discover kubectl plugins
uninstall Uninstall plugins
update Update the local copy of the plugin index
upgrade Upgrade installed plugins to newer versions
version Show krew version and diagnostics

-h, --help help for krew
-v, --v Level number for the log level verbosity

Use "kubectl krew [command] --help" for more information about a command.

1 thought on “How to Install Krew Plugin Manager for Kubectl CLI on Linux”

Leave a Comment