DEV Community

Cover image for Essential plugins for Kubectl CLI
Renjith Ravindranathan
Renjith Ravindranathan

Posted on


Essential plugins for Kubectl CLI

This is a short article about handy plugins that can be used along with kubectl CLI , which helps you to can reduce a few of your operational tasks from an admin perspective. Basically, we can extend the capabilities kubectl with the power of plugins, like checking the deprecations of components in the cluster or SSHing to the nodes.

We can install plugins using a plugin manager called krew and there are quite a few available on the website listed here as well. Let's look at how we can get started with plugins :)

The plugins are added using krew and the primary requirement is to install krew them in the system. You can use the below code snippet in Mac/Linux to install it

  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
Enter fullscreen mode Exit fullscreen mode

Once you have krew it in the system, now it is time to install the additional plugins.

There are many plugins available in the OSS GitHub repos, but below are some of my personal favorites.

1. Kubepug
KubePug/Deprecations is intended to be a kubectl plugin, which:

Downloads a swagger.json from a specific Kubernetes version
Parses this Json finding deprecation notices
Verifies the current kubernetes cluster or input files checking whether exists objects in this deprecated API Versions, allowing the user to check before migrating

kubectl krew install deprecations
kubepug --k8s-version=v1.18.6 # Will verify the current context against v1.18.6 swagger.json
Enter fullscreen mode Exit fullscreen mode

2. net-forward

Simple plugin that lest you create a local port listener on your personal machine that redirects to an arbitrary TCP service that the Cluster can see. This is similar to kubectl port-forward without the restriction that forwarding can only use Pods or Services as destinations.

kubectl krew install net-forward

kubectl net-forward -i -p 3389 -l 3389
I personally use this a lot to debug issues related to environment specific inside the Windows/Linux nodes.
Enter fullscreen mode Exit fullscreen mode

Please feel to try out the plugins on the krew website also, as there are other plugins that could be beneficial to your work.
Hope this info was helpful and thanks for reading the article.!


In case of any queries, please feel to connect me via the below links


Top comments (0)