---
title: "Learning the Kubectl Krew Plugin Manager Through Examples"
description: "Discover kubectl Krew plugin manager, and elevate your kubectl Krew plugin proficiency—Amplify your Kubernetes toolkit in this tutorial!"
canonical: "https://adamtheautomator.com/kubectl-krew/"
---

# Learning the Kubectl Krew Plugin Manager Through Examples

> Discover kubectl Krew plugin manager, and elevate your kubectl Krew plugin proficiency—Amplify your Kubernetes toolkit in this tutorial!

Source: https://adamtheautomator.com/kubectl-krew/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Learning the Kubectl Krew Plugin Manager Through Examples](https://adamtheautomator.com/wp-content/uploads/2024/01/kubectl-krew.jpg)

# Learning the Kubectl Krew Plugin Manager Through Examples

[![](https://secure.gravatar.com/avatar/2788bb1a3f735603f81eca51d68daec56a9d97e805a10268fb2c20afcc76b81b?s=192&d=mm&r=g)Nicholas Xuan Nguyen](https://adamtheautomator.com/author/nicholas-xuan-nguyen/)31 January 20245 min. read

Categories: [DevOps](/category/devops/)

Tags:[Krew](/tag/krew/)[Kubernetes](/tag/kubernetes/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [Installing the kubectl Krew Plugin Manager](#installing-the-kubectl-krew-plugin-manager)
*   [Discovering and Installing Plugins with Krew](#discovering-and-installing-plugins-with-krew)
*   [Keeping Your Krew Plugins in Top Shape](#keeping-your-krew-plugins-in-top-shape)
*   [Expanding Your kubectl Universe with Custom Plugin Indexes](#expanding-your-kubectl-universe-with-custom-plugin-indexes)
*   [Cleaning Up Obsolete Plugins](#cleaning-up-obsolete-plugins)
*   [Conclusion](#conclusion)

Have you ever bumped into the walls of `kubectl` capabilities, wishing you could do more with your command-line tools? If this situation resonates with you, you are not alone. Countless developers and systems administrators have experienced similar limitations. Fortunately, a shining solution is on the horizon—the `kubectl` Krew plugin manager.

In this tutorial, you will dive into the world of Krew and learn to install and integrate it with your `kubectl` workflow.

Keep reading and wield a more powerful `kubectl` toolset.

## Prerequisites

Before diving into the `kubectl` Krew plugin manager, ensure you have the following in place if you wish to follow along:

*   A machine running Linux, macOS, or Windows – This tutorial uses an Ubuntu 20.04 system.

Related:[Install Ubuntu Server 20.04: A Step-by-Step Walkthrough](https://adamtheautomator.com/install-ubuntu/)

*   Access to a functioning Kubernetes cluster.

Related:[Jumpstart Kubernetes Locally with this MiniKube Tutorial](https://adamtheautomator.com/minikube-tutorial/)

*   kubectl is installed and configured.

Related:[Master Installing Kubernetes on Ubuntu](https://adamtheautomator.com/installing-kubernetes-on-ubuntu/)

*   [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) is installed.

Related:[Getting Started with Git Bash Commands on Windows](https://adamtheautomator.com/git-bash-commands/)

## Installing the kubectl Krew Plugin Manager

Imagine a world where your Kubernetes interaction is not just about what comes out of the box but a world tailored to your needs. Think of Krew as your personal Kubernetes assistant, ready to equip you with the tools you need to handle any complex or specific task.

But first, you must install the Krew plugin manager and get access to a vast repository of plugins. Let Krew take you from running basic `kubectl` commands to executing advanced operations precisely.

To install the Krew plugin manager, carry out the following:

1\. Create a new Bash shell script called _kubectl\_krew.sh_ on your machine with your preferred editor.

Related:[How to Get Started With Gedit Linux](https://adamtheautomator.com/gedit-linux/)

2\. Next, populate the script with the following code snippet, and save and close the editor.

The below code automates the Krew’s installation on your machine.

```bash
(
  # Enable debugging to show commands and their arguments as they are executed.
  set -x; 
  # Change the directory to a new temporary directory created by'mktemp'.
  cd "$(mktemp -d)" && 

  # Capture the OS type in lowercase and store it in the variable 'OS'.
  OS="$(uname | tr '[:upper:]' '[:lower:]')" &&

  # Determine the architecture, normalize x86_64 to amd64, any arm variant to arm/arm64, aarch64 to arm64, and store it in the variable 'ARCH'.
  ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\\(arm\\)\\(64\\)\\?.*/\\1\\2/' -e 's/aarch64$/arm64/')" &&

  # Construct the Krew binary filename based on the OS and architecture.
  KREW="krew-${OS}_${ARCH}" &&

  # Download the Krew tarball for the appropriate OS and architecture.
  curl -fsSLO "<https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz>" &&

  # Extract the downloaded tarball.
  tar zxvf "${KREW}.tar.gz" &&

  # Run the Krew installer script to install Krew.
  ./"${KREW}" install krew
)
```

Related:[CURL Linux Command: Learning By Example](https://adamtheautomator.com/curl-linux/)

3\. Run the below `chmod` command, which provides no output but makes the `kubectl_krew.sh` script executable.

```bash
chmod +x kubectl_krew.sh
```

Related:[Master Linux Permissions: A Deep Dive into Chmod](https://adamtheautomator.com/chmod-and-chown/)

4\. Now, run the command below to execute the `kubectl_krew.sh` script.

```bash
./kubectl_krew.sh
```

![Installing the Kubectl Krew plugin manager via the kubectl\_krew.sh Bash script](https://adamtheautomator.com/wp-content/uploads/2024/01/image-261.png)

Installing the Kubectl Krew plugin manager via the _kubectl\_krew.sh_ Bash script

5\. Run the below [`export`](https://www.digitalocean.com/community/tutorials/export-command-linux) command to add the Krew(`$HOME/.krew/bin`) to your `$PATH` variable, and restart your shell.

This command has no output but ensures Krew is accessible from any terminal session.

```bash
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
```

Related:[How To Wrangle Ubuntu Environment Variables](https://adamtheautomator.com/ubuntu-environment-variables/)

6\. Lastly, execute the following `kubectl` command to check if `krew` has been installed successfully.

```bash
kubectl krew
```

If successful, you will see Krew’s man page, as shown below.

![Verifying Krew has been installed](https://adamtheautomator.com/wp-content/uploads/2024/01/image-260.png)

Verifying Krew has been installed

## Discovering and Installing Plugins with Krew

After successfully installing the kubectl Krew Plugin Manager, you are now equipped to delve into adding firepower to your Kubernetes toolkit—by installing plugins with Krew. These plugins add versatility and efficiency to your Kubernetes workflow.

To discover and install plugins, you must first update your plugin index as follows:

1\. Execute the following command to refresh (`update`) your local copy of the Krew plugin index.  
Doing so guarantees you will get the latest and most excellent tools.

```bash
kubectl krew update
```

![Updating the plugin index](https://adamtheautomator.com/wp-content/uploads/2024/01/image-265.png)

Updating the plugin index

2\. Once updated, run the command below to `search` for all available plugins in the default [Krew repository](https://github.com/kubernetes-sigs/krew-index) (`krew`).

```bash
kubectl krew search
```

You will see a comprehensive list of all the available plugins, along with their descriptions.

Pick one plugin from the list that you wish to install.

![Searching all available plugins ](https://adamtheautomator.com/wp-content/uploads/2024/01/image-264.png)

Searching all available plugins

Looking for something specific? Pipe the `grep` command to search for a particular plugin by name/keyword (i.e., `images`)

```bash
kubectl krew search | grep images
```

![Narrowing down the search with grep](https://adamtheautomator.com/wp-content/uploads/2024/01/image-263.png)

Narrowing down the search with grep

Related:[PowerShell Grep: Unleash the Power of Text Search](https://adamtheautomator.com/powershell-grep/)

3\. Next, run the following command to `install` the plugin (`images`) you picked in step two.

```bash
kubectl krew install images
```

![Installing plugins with Krew](https://adamtheautomator.com/wp-content/uploads/2024/01/image-266.png)

Installing plugins with Krew

4\. With the plugin installed, execute the below command to run the plugin (`images`). This plugin inspects and lists container images across your Kubernetes cluster.

```bash
kubectl images
```

![Running the installed plugin (images)](https://adamtheautomator.com/wp-content/uploads/2024/01/image-262.png)

Running the installed plugin (images)

## Keeping Your Krew Plugins in Top Shape

Like any other software, Krew plugins require maintenance to perform optimally. Thankfully, Krew has you covered with commands to keep your plugins up-to-date and running smoothly.

To keep your Krew plugins in top shape, proceed with the following:

Run the following command to `upgrade` all installed plugins to their latest versions.

This command is your all-access pass to the latest features and fixes, ensuring Krew and its installed plugins function at their best.

```bash
kubectl krew upgrade
```

![Upgrading all installed plugins to their latest versions](https://adamtheautomator.com/wp-content/uploads/2024/01/image-268.png)

Upgrading all installed plugins to their latest versions

Prefer a more targeted approach? Execute the same command, appending the plugin name (i.e., `images`). This approach streamlines your upgrade process and keeps your toolkit customized to your workflow.

```bash
kubectl krew upgrade images
```

![Upgrading individual plugins](https://adamtheautomator.com/wp-content/uploads/2024/01/image-267.png)

Upgrading individual plugins

## Expanding Your kubectl Universe with Custom Plugin Indexes

The power of Krew extends beyond the default Krew index, giving you access to a broader world of plugins. These plugins include those tailored by individual authors or organizations.

You can integrate custom indexes into your Krew ecosystem with the following syntax.

```bash
kubectl krew index add <index_name> <index_url>
```

This syntax applies whether you integrate a specialized tool developed in-house at your company or a niche plugin from the community.

To achieve custom plugin integrations, perform the following:

1\. Run the following command to `add` a custom plugin index named `appscode` (arbitrary) from _`https://github.com/appscode/krew-index.git`_. Ensure you replace the URL with the custom index’s URL you wish to add.

```bash
kubectl krew index add appscode https://github.com/appscode/krew-index.git
```

![Adding a custom index plugin](https://adamtheautomator.com/wp-content/uploads/2024/01/image-271.png)

Adding a custom index plugin

2\. After adding the index, execute the `krew update` command below to refresh your list of available plugins.

```bash
kubectl krew update
```

![Updating the list of available plugins](https://adamtheautomator.com/wp-content/uploads/2024/01/image-270.png)

Updating the list of available plugins

3\. Lastly, run the command below to `install` a `kubectl` plugin (`db`) from your custom plugin index (`appscode`).

```bash
kubectl krew install appscode/dba
```

![Installing a plugin (db) from a custom plugin index (appscode)](https://adamtheautomator.com/wp-content/uploads/2024/01/image-269.png)

Installing a plugin (db) from a custom plugin index (appscode)

## Cleaning Up Obsolete Plugins

Too many installed plugins can lead to clutter, slowing your workflow and complicating management tasks. Fortunately, Krew makes overseeing the plugins you have installed a breeze.

To clean up obsolete plugins, you first need an overview of your current Krew plugin lineup as follows:

Execute the `krew` command below to `list` all plugins currently installed via the Krew plugin manager.

```bash
kubectl krew list
```

You will see a neatly organized list of all the `kubectl` plugins installed, along with their versions, as shown below.

![Listing all plugins installed via the Krew plugin manager](https://adamtheautomator.com/wp-content/uploads/2024/01/image-274.png)

Listing all plugins installed via the Krew plugin manager

Now, run the following command to uninstall the plugins (`dba`) you no longer use.

This command helps you find and declutter your Kubernetes environment—a hassle-free way to clean up.

```bash
kubectl krew uninstall dba
```

![Uninstalling a plugin](https://adamtheautomator.com/wp-content/uploads/2024/01/image-273.png)

Uninstalling a plugin

## **Conclusion**

Krew has emerged as an essential toolkit for anyone immersed in the Kubernetes ecosystem with its expansive repository brims with plugins. By streamlining the process of installing and managing `kubectl` plugins, you have elevated the command-line experience with `kubectl` Krew plugin manager.

You now have a robust set of tools at your fingertips to supercharge your Kubernetes operations. But since Krew offers a platform for proactive and creative minds to innovate and contribute, why not [design your own bespoke plugins](https://krew.sigs.k8s.io/docs/developer-guide/)?

Address specific needs within your workflows by sharing them via a custom index, and empower a broader community!

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fkubectl-krew%2F&text=Learning%20the%20Kubectl%20Krew%20Plugin%20Manager%20Through%20Examples)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fkubectl-krew%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fkubectl-krew%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/07/featured_image-3.png)

### [Build Your First Internal Developer Platform](/build-first-internal-developer-platform/)

Build your first Internal Developer Platform with Backstage, a software catalog, software templates, CI/CD handoffs, and Kubernetes deployment manifests.

![](https://adamtheautomator.com/wp-content/uploads/2026/06/featured_image-9.png)

### [DevOps to Platform Engineer: 2026 Transition Roadmap](/devops-platform-engineer-2026-transition-roadmap/)

Learn how to move from DevOps to platform engineering in 2026 with a practical roadmap covering transferable skills, internal developer platforms, Backstage, Crossplane, and portfolio projects.

![](https://adamtheautomator.com/wp-content/uploads/2024/02/kubernetes-blue-green.jpg)

### [Learning the Kubernetes Blue Green Deployment Strategy](/kubernetes-blue-green/)

Dive into Kubernetes blue-green deployments for smooth updates. Enhance your release process with this smart Kubernetes strategy!

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
