DEV Community

Joe Hobot
Joe Hobot

Posted on

Few Helpful CLI Tools for Managing Kubernetes

When I first started out with Kubernetes, one of the things I learned is that managing multi clusters and kube configs is not easy. So over time I kept scavenging for github and tools that could accommodate my needs to improve productivity as well as avoid human error.

While some love to set their environment variables for multiple kube config paths, I actually hate it because one little mistake and you could be in different environment without even knowing. So I have all my cluster info in one kube config.

For that issue I've been using a cli tool called

kubectx - I can switch between clusters by just hitting the tabs and because I use zsh with kubernetes module, it makes sure that I am on the right cluster.


When dealing with multi clusters, well there is many namespaces as well. Sure I could just go ahead and do stuff like

kubectl get pods -n someNamespaces

Thats bit boring and when doing something like command below it can bite you in the A$$

kubectl create -f /yeya/this/is/for/qa.yaml -n ProdNamespace 

So instead of appending --namespace SomeNamespace, I chose to be always in a namespace I need to be with tool called

Kubens - which is made by same GH author as above, with easy brew installation.


Logs are important and to view them in Kubernetes world you either have to execute something like command below and view the shi** load of logs, or have a log aggregator like Graylog, Sumologic and what not.

kubectl logs MyPodIsAwesome -n namespace

But..yup there is always a but.. what if you don't know exactly the name of the pod and or want to see logs from all pods starting with name nginx.. well this next CLI tool is a winner.. It tails k8s logs for strings you want to display. This was introduced to me by one of my fellow co-workers..


Btw there is one more , its called kube-shell. Really nice tool if you are new to kubernetes and are not so much familiar with it, or simly you forget commands but know how it starts. Kube-Shell is auto complete CLI tool for K8s.

That's all I got for you at this moment, feel free to share some of your favorite kubernetes tools, by the way I made a quick demo of those tools on YT channel that I should update soon.

Top comments (0)