NonTechCompany
Published in

NonTechCompany

Cool Kubernetes command line plugins

Lately, I have been using my old set of kubectl command over and over, and I think it’s time to try around in hope to find some good tools that might come in handy for my day to day work.

Kubectl have a plugins management that we can use to install a plugin (like brew) called Krew

Installation

krew can be installed easily using brew 😆

brew install krew

and after we installed it, we can list available plugins via

kubectl krew search

in this blog, I will only tried the one compatible with my machine (sadly, not all plugins support Mac m1 yet)

to install the plugin, simply go with

kubectl krew install <plugin-name>

access-matrix

kubectl access-matrix --namespace default

access-matrix is very useful plugin to see the permission of your subject.

it can use to view access to the resource in the namespace, or review access of another user, or service account and display it in an easy to understand format (icon)

mtail

kubectl mtail -k <label-selector> # -k is to add colored to different podkubectl mtail -k app=prometheus

mtail is super useful when you want to tail and follow the logs from multiple pods at the same time using selectors

mtail tails log and follow all pods match the selector we give

once we run mtail it will show the logs of all pods in different colors using -k

get-all

kubectl get-all

there is no simpler definition of this plugin than get ALL!

as opposed to

kubectl get all

that only get core resource such as pod, deployment, daemonset, etc

get-all literally get all, including all of the mentioned above and your CRDs and operators

CRDs and resources are also return from get-all

you can also adjust the scope, exclude, or get-all in only namespace.

graph

kubectl graph <resource>
kubectl graph ns

graph is used for visualizing Kubernetes resources and their relationship

images

kubectl images

images shows all the images used in the cluster in a readable table format

neat

kubectl get pod mypod -o yaml | kubectl neat

neat clean your resource yaml into vanilla version of it.

it removes additional fields such as status, creation time, uid, etc

this is helpful in development process and handy in replication of resource into another ns

normal get pod
after being neated

pod-lens

k pod-lens #interactive command

Find related workloads, namespace, node, service, configmap, secret,
ingress, PVC, HPA and PDB by pod name and display them in a tree and table.
Find more information at: https://pod-lens.guoxudong.io/

select your pods
all related resources of the given pods are shown in tree-like format

prune-unused

kubectl prune-unused

useful quick command to run and clear unused resource in the cluster

Prune unused configmaps/secret resources from a given namespace. It
checks against all resources from mounted volumes, env and envFrom and
imagePullSecrets.

score

kubectl score score <resource-file.yaml>

score is used to check the configuration of your resource yaml file

I find this plugin super helpful and CI/CD friendly

This should be put into you DevOps workflow immediately

show score and where you should improve

# Fun plugins in found

snap: delete half of the pods in the cluster. Oops!

There are still more cool stuffs in the list that I did not cover, If I have a mood for it I might compile another version of them in the next blog. also, lots of plugins are not supported in m1, so I might miss tons of cool plugins that I should try.

Hope you guys enjoy this, and If you know the one that I should try, leave me a comment.

Adios!

--

--

--

We are not a tech company, but we want to share a techy tech stuff.

Recommended from Medium

IAP Message Exchange Patterns & Network Topologies

Integrating dependabot into your .NET Core project on GitHub

READ/DOWNLOAD$= OCA Java SE 8 Programmer I Study G

Smart Data Logging for Connected Vehicle Value Creation — Sibros

Reactor pattern in Hangman Game

Safe Automatic Cleanup of Old Objects (on OpenStack Swift Containers)

Turn any RGB color to Material Color for flutter

AWS S3 with Java — Even Better

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tanat Paul Lokejaroenlarb

Tanat Paul Lokejaroenlarb

SRE at work — Tech Blogger— Coffee Lover

More from Medium

Demystifying Vault’s Secrets Management Solutions in Kubernetes

Monitor Kubernetes Events With Falco For Free

Kiali releases 1.44 and 1.45: Features update

Create a Helm chart automatically from Kubernetes YAMLs