Kubernetes: Krew plugins manager, and useful kubectl plugins list
Tags: kubernetes, todayilearned, devops
Published: 2021-10-14 09:28:55

---
title: Kubernetes: Krew plugins manager, and useful kubectl plugins list
published: true
date: 2021-10-01 06:48:50 UTC
tags: kubernetes,todayilearned,devops
canonical_url: https://rtfm.co.ua/en/kubernetes-the-krew-plugins-manager-and-useful-kubectl-plugins-list/
---

![](https://cdn-images-1.medium.com/max/1024/1*5-LJw8RG96qMMxPZeKcV5w.png)

One of the most valuable features of the `kubectl` utility is its plugins.

Of course, there are things like [Lens](https://k8slens.dev/), widely used by developers who don’t like working in the terminal, or tools like [`k9s`](https://k9scli.io/), but `kubectl`'s plugins worth for a dedicated post.

So, in this post, we will install the Krew  - `kubectl`'s plugins manager, and will take a look at the list of the plugins, that are used by me during work.

### The Krew — plugins manager for the `kubectl`

Recently, `kubectl` got its own plugins manager, the [Krew](https://krew.sigs.k8s.io/).

It has a plugins repository used to install and upgrade plugins.

On the Arch Linux `krew` can be installed from AUR:

Arch Linux:

```
$ yay -S krew
```

Update its packages list:

```
$ kubectl krew update
```

Look for a plugin, for example the `topology`:

```
$ kubectl krew search topology
NAME DESCRIPTION INSTALLED
topology Explore region topology for nodes or pods no
```

Install it:

```
$ kubectl krew install topology
Updated the local copy of plugin index.
Upgrades available for installed plugins:
* rbac-tool v1.2.1 -> v1.3.0
Installing plugin: topology
Installed plugin: topology
\
| Use this plugin:
| kubectl topology
| Documentation:
| [https://github.com/bmcustodio/kubectl-topology](https://github.com/bmcustodio/kubectl-topology)
/
```

And check:

```
$ kubectl topology help
Provides insight into the topology of a Kubernetes cluster.
Usage:
kubectl-topology [command]
Available Commands:
help Help about any command
node Provides insight into the distribution of nodes per region or zone.
pod Provides insight into the distribution of pods per region or zone.
```

### `kubectl` - useful plugins list

At the end of this post I’ll add a couple of links with a similar plugins list, and here below let’s take a look at the best, as for me, plugins that I’m using during work.

#### `kubectl-topology`

Let’s start from the [`kubectl-topology`](https://github.com/bmcustodio/kubectl-topology) plugin that allows to display all cluster's WorkerNodes, their regions, and pods located on each node:

![](https://cdn-images-1.medium.com/max/560/0*5Q9QYPdp1WEQKqV1.png)

![](https://cdn-images-1.medium.com/max/1024/0*-XNqWKYIZ6ZHgMCl.png)

#### `kubectl-resources`

The [`kubectl-resources`](https://github.com/howardjohn/kubectl-resources) plugin can display extended information about limits and resources used by pods on WorkerNodes.

Install with Go:

```
$ go get github.com/howardjohn/kubectl-resources
```

![](https://cdn-images-1.medium.com/max/1024/0*oKORTm29kz9y-zxb.png)

#### `kubectl-free`

The [`kubectl-free`](https://github.com/makocchi-git/kubectl-free) plugin is similar to the `free` utility in Linux - it will display information about used and available resources on WorkerNodes.

Install it by downloading an archive from the release page, unzip, and copy to the `/usr/local/bin`:

```
$ cd /tmp/
$ wget [https://github.com/makocchi-git/kubectl-free/releases/download/v0.2.0/kubectl-free_0.2.0_Linux_x86_64.zip](https://github.com/makocchi-git/kubectl-free/releases/download/v0.2.0/kubectl-free_0.2.0_Linux_x86_64.zip)
$ unzip kubectl-free_0.2.0_Linux_x86_64.zip
$ sudo cp kubectl-free_0.2.0_Linux_x86_64/kubectl-free /usr/local/bin/
```

And run it:

![](https://cdn-images-1.medium.com/max/1024/0*5B6AR5yGochOt0ua.png)

#### `kubecolor`

[`kubecolor`](https://github.com/dty1er/kubecolor) is very useful to make kubectl's output more readable by colonizing it.

Install with Go:

```
$ go install github.com/dty1er/kubecolor/cmd/kubecolor@latest
```

Add an alias to the `~/.bashrc`:

```
alias kk="kubecolor"
```

And its result:

![](https://cdn-images-1.medium.com/max/1024/0*2mCzdR1Db31ZEjXj.png)

#### `kubectl-watch`

An improved variant of the `kubectl --watch`. The project's page is [here>>>](https://github.com/lee0c/kubectl-watch).

Install:

```
$ git clone [https://github.com/lee0c/kubectl-watch.git](https://github.com/lee0c/kubectl-watch.git)
$ cd kubectl-watch
$ chmod +x kubectl-watch
$ sudo mv kubectl-watch /usr/local/bin/
```

Check:

```
$ kubectl plugin list
The following kubectl-compatible plugins are available:
/usr/local/bin/kubectl-watch
…
```

And run:

![](https://cdn-images-1.medium.com/max/701/0*UfXEKNRk_EPnQqen.gif)

#### `kubectl-clogs`

An advanced logs viewer. Similar to the `kubectl logs -f`, but can tail logs from all pods in a namespace. More details [here>>>](https://github.com/ivkalita/kubectl-clogs).

Install:

```
$ go install github.com/ivkalita/kubectl-clogs/cmd/kubectl-clogs@latest
```

And check logs from the _istio-system_ namespace:

![](https://cdn-images-1.medium.com/max/1024/0*fHNmOcPo8ThlUIoE.png)

#### `kubectl-who-can`

[`kubectl-who-can`](https://github.com/aquasecurity/kubectl-who-can) is used to display RBAC permissions and accesses.

Install with Krew:

```
$ kubectl krew install who-can
```

And check who is able to delete pods in the _default_ namespace:

![](https://cdn-images-1.medium.com/max/1024/0*we9clQdEP9i-gjsa.png)

#### `kubectl-rolesum`

[`kubectl-rolesum`](https://awesomeopensource.com/project/Ladicle/kubectl-rolesum) is also used to work with the Kubernetes RBAC to check permissions.

Install:

```
$ kubectl krew install rolesum
```

And check permissions for the _kiali-service-account_ ServiceAccount in the _istio-system_ namespace:

![](https://cdn-images-1.medium.com/max/798/0*JAlgfHhxdLoHQ_l0.png)

#### `ketall`

[`ketall`](https://github.com/corneliusweig/ketall) will display indeed all resources including Secrets, ServiceAccount, Roles, Binding, and so on, and not only Pods, Services, Daemonsets, Deployments, and ReplicaSets, as it is when using the `kubectl` get all.

Install:

```
$ kubectl krew install get-all
```

An example of the `kubectl get all` command's output:

![](https://cdn-images-1.medium.com/max/1024/0*JtOh1bfs3QGjZQ5l.png)

And with the `ketall` - `kubectl get-all`:

![](https://cdn-images-1.medium.com/max/692/0*OZc7ZC3x68_TG_pT.png)

#### `kubectl-status`

[kubectl-status](https://awesomeopensource.com/project/bergerx/kubectl-status#usage) can display extended information about pods' statuses, nodes, deployments, services, and so on.

Install:

```
$ kubectl krew install status
```

And check Kubernetes WorkerNodes status with the `role: data-workers` label set:

![](https://cdn-images-1.medium.com/max/1024/0*Qgzy7lM02jubAxaL.png)

#### `Pod-Dive`

[`Pod-Dive`](https://awesomeopensource.com/project/caiobegotti/Pod-Dive) will display information about a Kubernetes Pod  -  its WorkerNode, a namespace, containers in that pod, and other pods, that are running on the same WorkerNode.

Install:

```
$ kubectl krew install pod-dive
```

And check a Pod:

![](https://cdn-images-1.medium.com/max/823/0*o3Y1oVbAoQjOSLKJ.png)

#### `kubectl-janitor`

[`kubectl-janitor`](https://awesomeopensource.com/project/dastergon/kubectl-janitor) - a "cleaner" for a Kubernetes cluster. Can find problematic resources, such as unscheduled pods, failed jobs, volumes, etc.

Install:

```
$ kubectl krew install janitor
```

And find all pods that are not scheduled to a WorkerNode:

![](https://cdn-images-1.medium.com/max/1024/0*9eO3aGVHorq8WyaS.png)

#### `kubectl-cf`

And the last plugin for today  -  [`kubectl-cf`](https://github.com/spongeprojects/kubectl-cf).

Actually, there are a lot of plugins to simply work with `kubectl`'s contexts, but I'm using dedicated files for clusters instead of dedicated contexts:

```
$ ls -1 ~/.kube/ | grep kubeconfig
dev-1–18.kubeconfig
prod-1–18.kubeconfig
stage-1–18.kubeconfig
test-1–18.kubeconfig
```

For a faster switch between them, we can use the `kubectl-cf` plugin, that will work via creating symlinks to the `~/.kube/config` file.

Pay attention, that all files must have the `.kubeconfig` extension.

Install it — clone its repository, build, and copy to the `/usr/local/bin`:

```
$ git clone [https://github.com/spongeprojects/kubectl-cf.git](https://github.com/spongeprojects/kubectl-cf.git)
$ cd kubectl-cf/
$ go build -o kubectl-cf
$ sudo cp kubectl-cf /usr/local/bin/
```

![](https://cdn-images-1.medium.com/max/891/1*MLKl7cuxfdm8wNpqD5nTmg.gif)

### Useful links

- [awesome-kubectl-plugins](https://github.com/ishantanu/awesome-kubectl-plugins) — a curated list of awesome kubectl plugins
- [Top 179 Kubectl Plugins Open Source Projects on Github](https://awesomeopensource.com/projects/kubectl-plugins)

_Originally published at_ [_RTFM: Linux, DevOps, and system administration_](https://rtfm.co.ua/en/kubernetes-the-krew-plugins-manager-and-useful-kubectl-plugins-list/)_._

* * *