Photo by Mediamodifier / Unsplash
Photo by Mediamodifier / Unsplash

Just 7 Remarkable K8S Tools Boosting Up Your Effectiveness

Tired of repeating kubectl command lines? Simplify your life and increase your efficiency on Kubernetes

Guillaume Vincent
Guillaume Vincent

Kubernetes is a great technology to orchestrate containers and microservices. It offers a rich ecosystem with plenty of different objects and concepts to have up and running applications. kubectl is the number 1 you learn to interact with a cluster through the command line.

Although knowing kubectl is important you might find yourself repeating the same actions and losing time. Here, we will review 7 tools that are tenfold your efficiency when working with Kubernetes. The goal is to make you discover them and I hope after that you will adopt them. In each tool section, you will find references to the official resources to go further.

The Toolbox

1/ Kube-shell

A little help would be nice when typing kubectl commands to reduce errors and boost up your speed. kube-shell is an integrated shell for Kubernetes CLI. It provides easy-of-user kubectl to be more productive:

kubectl autocompletion with kube-shell
kubectl auto-completion with kube-shell

A simple line to install it:

$ pip install kube-shell
GitHub - cloudnativelabs/kube-shell: Kubernetes shell: An integrated shell for working with the Kubernetes
Kubernetes shell: An integrated shell for working with the Kubernetes - GitHub - cloudnativelabs/kube-shell: Kubernetes shell: An integrated shell for working with the Kubernetes

2/ Kubectx - Kubens

Are you managing multiple Kubernetes clusters? kubectx helps you switch between clusters back and forth:

Switch between Kubernetes cluster with kubectx
Switch between Kubernetes clusters with kubectx

At each kubectl command we indicate the namespace to interact with the desired resources. kubens allows avoiding having to specify it each time:

Switch between namespaces with kubens
Switch between namespaces with kubens
GitHub - ahmetb/kubectx: Faster way to switch between clusters and namespaces in kubectl
Faster way to switch between clusters and namespaces in kubectl - GitHub - ahmetb/kubectx: Faster way to switch between clusters and namespaces in kubectl

3/ Kubetail

kubetail aggregates logs from multiple pods into one stream. It is the as running kubectl logs -f but for multiple pods.

$ kubectl get pods
NAME                   READY     STATUS    RESTARTS   AGE
app1-v1-aba8y          1/1       Running   0          1d
app1-v1-gc4st          1/1       Running   0          1d
app1-v1-m8acl  	       1/1       Running   0          6d
app1-v1-s20d0  	       1/1       Running   0          1d
app2-v31-9pbpn         1/1       Running   0          1d
app2-v31-q74wg         1/1       Running   0          1d
my-demo-v5-0fa8o       1/1       Running   0          3h
my-demo-v5-yhren       1/1       Running   0          2h

$ kubetail app2

You can specify the containers in the pod:

$ kubetail app2 -c container1
$ kubectail app2 -c container1 -c container2
GitHub - johanhaleby/kubetail: Bash script to tail Kubernetes logs from multiple pods at the same time
Bash script to tail Kubernetes logs from multiple pods at the same time - GitHub - johanhaleby/kubetail: Bash script to tail Kubernetes logs from multiple pods at the same time

4/ Kubetree

An application can have a lot of different resources and it is always obvious to map them. kubetree is a kubectl plugin to explore ownership relationships between Kubernetes objects:

$ kubectl krew install tree
Exploring NGINX deployment with kubectl tree
Exploring NGINX deployment with kubectl tree
GitHub - ahmetb/kubectl-tree: kubectl plugin to browse Kubernetes object hierarchies as a tree 🎄 (star the repo if you are using)
kubectl plugin to browse Kubernetes object hierarchies as a tree 🎄 (star the repo if you are using) - GitHub - ahmetb/kubectl-tree: kubectl plugin to browse Kubernetes object hierarchies as a tree ...

5/ K9S

k9s provides a terminal UI to interact with your Kubernetes cluster. It can be compared to the top command for processes. You can easily navigate, observe and manage your applications with it.

What's great is that changes in Kubernetes resources appear live. It's very useful to debug what's going on. Here is a video presenting what can be done with k9s :

K9s Tour
K9S video demo
GitHub - derailed/k9s: 🐶 Kubernetes CLI To Manage Your Clusters In Style!
🐶 Kubernetes CLI To Manage Your Clusters In Style! - GitHub - derailed/k9s: 🐶 Kubernetes CLI To Manage Your Clusters In Style!

6/ Kube-Capacity

kube-capacity is a simple CLI providing an overview of the resources requests, limits, and usage in a Kubernetes cluster.

Inspect the cluster nodes:

$ kube-capacity

NODE              CPU REQUESTS    CPU LIMITS    MEMORY REQUESTS    MEMORY LIMITS
*                 560m (28%)      130m (7%)     572Mi (9%)         770Mi (13%)
example-node-1    220m (22%)      10m (1%)      192Mi (6%)         360Mi (12%)
example-node-2    340m (34%)      120m (12%)    380Mi (13%)        410Mi (14%)

Now includes the pods:

$ kube-capacity --pods

NODE              NAMESPACE     POD                   CPU REQUESTS    CPU LIMITS    MEMORY REQUESTS    MEMORY LIMITS
*                 *             *                     560m (28%)      780m (38%)    572Mi (9%)         770Mi (13%)

example-node-1    *             *                     220m (22%)      320m (32%)    192Mi (6%)         360Mi (12%)
example-node-1    kube-system   metrics-server-lwc6z  100m (10%)      200m (20%)    100Mi (3%)         200Mi (7%)
example-node-1    kube-system   coredns-7b5bcb98f8    120m (12%)      120m (12%)    92Mi (3%)          160Mi (5%)

example-node-2    *             *                     340m (34%)      460m (46%)    380Mi (13%)        410Mi (14%)
example-node-2    kube-system   kube-proxy-3ki7       200m (20%)      280m (28%)    210Mi (7%)         210Mi (7%)
example-node-2    tiller        tiller-deploy         140m (14%)      180m (18%)    170Mi (5%)         200Mi (7%)
GitHub - robscott/kube-capacity: A simple CLI that provides an overview of the resource requests, limits, and utilization in a Kubernetes cluster
A simple CLI that provides an overview of the resource requests, limits, and utilization in a Kubernetes cluster - GitHub - robscott/kube-capacity: A simple CLI that provides an overview of the res...

7/ Lens

Lens is the Kubernetes IDE for monitoring and debugging. It is an application that runs on your desktop (Windows, Linux, and Mac). Perfect if you want to develop comfortably on Kubernetes:

Introduction to Lens - The Kubernetes IDE
Lens | The Kubernetes IDE
Lens IDE for Kubernetes. The only system you’ll ever need to take control of your Kubernetes clusters. It’s open source and free. Download it today!

Conclusion

These 7 tools are not exhaustive. I have presented the ones I use the most on a daily basis. I advise you to go to the link below to explore and discover others.
You will find your happiness for sure!

GitHub - tomhuang12/awesome-k8s-resources: A curated list of awesome Kubernetes tools and resources.
A curated list of awesome Kubernetes tools and resources. - GitHub - tomhuang12/awesome-k8s-resources: A curated list of awesome Kubernetes tools and resources.
Cloud-Native

Guillaume Vincent Twitter

DevOps Engineer & AWS Certified Solution Architect. Cloud enthusiast and automation addict