E1: Moving from Lens to k9s for Kubernetes visibility
TLDR: k9s is provides all the features I used in Openlens previous to their downgrade in 6.3.0 and it will likely stay this way since there is no commercial version of k9s and no company behind it. Give it a shot.
Openlens and k9s offer visibility into your Kubernetes cluster. Running a kubectl command everytime you need any information about your cluster can be cumbersome. The obvious solution to this is to have some kind of UI that shows you all the resources in your cluster.
As many people felt the need to have a UI for their Kubernetes clusters, many different solutions have emerged. The most prominent one are:
kube-dashboard
Lens
k9s
kubenav (mobile)
And there are even more than just these 4.
Lens is an electron app with both a commerical version (called Lens) and a free and open source version (called Openlens). I have been a long time user of openlens, mostly because it's what my company was already using when I joined. The free version has been working just fine for me and had everything I could ask for, until it didn't. Recently, the lens developers have decided to downgrade Openlens in order to get more people to use their commerical version.
Many users where caught by suprise when they updated Openlens to version 6.3.0 and discovered that the buttons for accessing logs and getting a shell on a pod where gone. In a discussion on a Github issue, opened by one such surprised user, they proclaimed to have made these changes for “more secure and faster booting” while at the same time pointing out that these buttons are still available in the commercial version.
Not sure when the last time was that I saw this many downvotes on Github.
They surely got a lot of negative feedback, people are especially furious about the fact that they tried to sell this as "for security reasons". People don't like it when you lie to their face, who would have thought.
I liked Oenlens but now, the free version is not up to the task anymore and I don't want to support a company that downgrades an open source product and lies to their uses by calling it a security patch.
Anyway, there were many people talking (complaining) about this change on both Reddit and Twitter. The most recommended alternative in all of these discussion was k9s which I first tried about two weeks ago and so far I have been loving it.
There is a clear downside to it tho, it’s a terminal UI. This means no more clicking around, you will need to know keyboard shortcuts to get things done.
The screenshot below show k9s having me choose between the clusters configured in my ~/.kube/config
file
Once you get used to to this way of navigating your cluster, it's just so much faster. Even if the Lens developers rolled back their changes and added the buttons back in, I wouldn't return.
Anyone who likes to stay in the terminal during development (I mean you, vim users), will love this.
Working with k9s
Follow the instructions here to install k9s.
Once you have it installed, the command k9s will bring up the terminal UI.
If you have multiple clusters in you kubeconfig, the first screen will generally prompt you to choose a cluster, as seen in the previous screenshot.
You navigate up and down this list with j and k, which you might be familar with from the editor vim
Pressing : will bring up a prompt for you to enter commands. Some of the most common comands are
ctx → brings up the screen to choose a cluster again
ctx SANDBOX → will directly bring you to the cluster called SANDBOX
ns → brings up a screen where you switch between namespaces
pod → will you show you all pods in the current namespace, the same goes for the name of all other k8s ressources, e.g. service will bring up all services
Some other good to know shortcuts
s while hovering over a pod will give you a shell (ctrl d will let you leave the shell again and return to k9s)
l while hovering over a pod will give you logs (esc to go back, this goes for everything except the shell)
ctrl-k will kill a pod
ctrl-d will delete a pod
y will give you the yaml definition of a pod
shift-f (F) to setup port forwarding
Many useful shortcuts are also displayed on the top of the UI. There you can also always see which cluster you are operating in.
Namespaces you visit will also get assigned to numbers. In the screenshot below I`ve been visiting signoz and all namespaces and can now quickly switch between them by pressing 0 for all or 1 for signoz
Typing ? anywhere will bring up the help menu which shows you all shortcuts available
Conclusion
After 6.3.0 openlens can no longer really be considered a good option for visibility into your Kubernetes clusters. For companys that don’t mind paying for the commercial version of lens, it’s still a good opiton. That being said, k9s offers all the features of you need to operate your clusters effectively and will most likely stay free forever. When you work with it regularly and get used to the shortcuts, there is a good chance you will find yourself being faster then you could ever be with lens.
This newsletter is free but if you want to you can buy me a coffee / buy me a coffee.