7 April 2022
When managing your Kubernetes cluster, you must have noticed that it is not easy to interact with or have a good overview of it using only the CLI, i.e.,
kubectl. For example, quickly looking through this article on
kubectl commands can give you a glimpse of the immensity of it. As your Kubernetes usage gets more intensive and complex, it is only natural that you are looking for solutions to be more efficient day by day when working with your cluster. But you might have encountered some problems trying to choose between one management tool and another.
In this article, we will get back to the reality and limits of using only
kubectl to manage your cluster. Then, I will introduce you to different tools that can help you do so, but more efficiently. Finally, we will discuss which management tool suits you, depending on your use case.
Limits of using
kubectl is a CLI that is just a wrapper of
curl commands to your Kubernetes API. As a result, it is a very powerful tool to control your cluster, and with it, you can basically do anything you would ever want with Kubernetes.
As a counterpart, this tool is quite “heavy” on the mind: you have to memorize many commands and parameters to be efficient when using it. Moreover, it is at the end time-consuming to write commands unless you configured good aliases (which takes time too).
I can guess that I am not the only one thinking that using
kubectl can be a hassle sometimes. There may be simpler ways to get information or edit Resources in your Kubernetes cluster, and this is what we are going to see in the following sections.
Let’s start with the “official” management tool provided by Kubernetes: the Kubernetes Dashboard. This is a web-based UI that lets you have a pretty nice overview of your cluster Resources. You can also deploy applications by creating Deployment (and eventually Service) Resources and access to Pods logs, and that’s it! No possibility to deploy anything else, no access to manifests, etc.
Screenshot of the Kubernetes dashboard
Also, when I said “provided”, I guess we might have a misunderstanding: you have to deploy it on your own because it is not bundled with the creation of your Kubernetes cluster (and that may be a good thing). You can try it yourself on Kubernetes Dashboard’s GitHub repository.
We are far from being able to replace
kubectl entirely with this tool. The next management tool might be a good contender to fulfill this purpose!
Lens: “the K8s IDE”
Lens is a standalone desktop application that claims to be the “Kubernetes IDE”. Compared to Kubernetes Dashboard, it has a lot more features available: manage multiple clusters in the same app, access all manifests, edit them, spawn shells in Pods, etc.
This tool is very useful to have a good overview of all your clusters and to do some simple actions like quickly editing manifests and entering your Pod through a shell. As it is a GUI, it also brings a “point-and-click” approach to your Kubernetes management. It is uncommon in the systems' administration field but most welcomed seeing how easy it is to use. If you don’t believe me, just try Lens and see by yourself!
Screenshot of Kontena Lens
Antoine, SRE at Padok, had some words concerning Lens:
I use it to have a pretty overview of my clusters. The features that I love are: the hotbar to switch very quickly between my different contexts, the 1-click port-forward, and the ability to edit Secrets in 2 clicks only.
To apply manifests or get outputs in YAML, though, I still use
Node metrics and allocations may not work out of the box, too.
So, according to him, the “point-and-click” approach is very useful, but only for simple actions, as he still uses
kubectl for more complex use cases. We can then ask ourselves: is Lens practical enough for power users like sysadmins and SREs? Let’s find out about another tool that may fit better with our usage of
k9s: “Vim of Kubernetes”
By design, k9s is often considered the “Vim of Kubernetes”. Indeed, it is a very powerful TUI (Terminal User Interface) management tool controlled exclusively using your keyboard: shortcuts to search Resources, filter results, access logs, enable port-forward, scale your deployment, restart your Pods, etc. Basically, shortcut everything. I won’t list every feature in this article, but you can check them out on k9s’ main website.
Screenshot of k9s TUI
Térence, SRE at Padok, is a regular user of k9s. Here is what he thinks about it:
k9s is really practical to have a continuous overview of your clusters when you want to watch over a deployment, the creation of new nodes, etc. No need to craft something with
kubectl. As soon as you learn shortcuts, you can do anything really fast. The good thing is that they are “obvious”, so they are easy to learn: goodbye to the hundreds of commands and parameters! It is a huge boost in efficiency and productivity.
One downside would be that it can get a bit slow when managing a big cluster.
So, k9s looks very promising as an all-around replacement for
kubectl to manage your Kubernetes clusters on a daily basis. The “continuous view” aspect is also very nice to have. Indeed, it is crucial when you need to watch over your Resources’ automatic updates when working with GitOps, for example.
It might be too complex, though, especially for people not used to the “Vim” approach of navigation and who want to do simple actions but in large quantities.
Conclusion: which management tool for which usage?
In the end, it all depends on your use-case scenario.
Lens is easy to learn for people who don’t want to memorize new shortcuts. Personally, I would say it is more fitted for developers who want to have a nice overview of Kubernetes clusters where their apps are running, but it can fit for ops who like the GUI approach and still want to use
kubectl for a few commands.
On the other hand, k9s can take a bit longer to learn and use efficiently. However, it is very powerful, as it replaces almost every
kubectl command with a shortcut or navigation keys. It is more directed toward power users who are used to navigating CLI/TUI applications, not afraid to learn new shortcuts to gain efficiency.
We have to keep in mind one important aspect, though: each of these management tools adds a new abstraction layer to
kubectl. Because of that, you might forget how the CLI tool works behind the scenes. It can be quite embarrassing and slow you down when you are in an environment where only
kubectl is available to you or your team.
At Padok, we are looking every day for tools or solutions to improve developers’ daily lives or to work more efficiently. As such, feel free to recommend new tools to manage Kubernetes clusters by contacting me or anyone in the team!