← Back to Blog

Lens — The Perfect Tool for Managing Kubernetes

Today I want to introduce a tool that I think is pretty close to perfect for managing and monitoring a K8s cluster — Lens.

We used to have management tools like K9s, kubectl, etc., but these tools usually don't have an intuitive UI, or don't have all the features you need — Lens is different. This tool gives us a pretty full range of features that let us just click instead of typing long, hand-tiring terminal commands. Let's dive in and explore why so many people are using this tool.

Full support across environments

One thing that makes Lens so widely used is that it can run on pretty much all environments: Linux, Windows, Mac, etc. Not everyone uses windows as their main dev environment, but K8s management tools often only support Linux, so Lens released a Desktop version as a savior for windows users.

Automatically installing a metrics server

To connect to K8s, Lens uses that cluster's Kubeconfig — this is fairly simple so I won't walk through it.

A pretty neat feature Lens has around Clusters is it lets you automatically install a metric server so you can monitor cluster info with just a few clicks. To enable this feature, right-click on the cluster's name => Settings => Lens Metrics => Enable the metrics you want => Apply

Once activated, Lens automatically installs applications in the Lens-metrics namespace.

Once installed, you'll get metrics displayed like the image — CPU info, Memory usage, requests, limits, etc. — pretty intuitive, right 😃

Functions for Nodes

In Lens's side menu, things are organized into sections matching K8s components. In the node section is info about the nodes in our K8s cluster. Here, besides monitoring basic CPU, Ram, Disk info for nodes, you can exec into a node, Cordon, Drain, Edit, or Delete a node

The standout feature here is being able to run a Shell inside a node even if you don't have an ssh-key to ssh into it. Lens creates a node-shell so users can inject and run commands in that node with root permission 😳😳😳

Functions for Workloads

Next up is the Workloads section — here are the main resources responsible for running services: pods, Deployment, DaemonSets, StatefulSets, ReplicaSets, Jobs, CronJobs. I don't know about you, but I find Lens's UI design really intuitive — you can look at it and immediately tell where the system has an issue.

For a pod, you can edit, delete, run a shell inside it, and especially — view each container's logs within the pod, which is super useful for debugging.

For Deployment, DaemonSets, StatefulSets, ReplicaSets resources, you can all edit, delete, or manually scale to the desired pod count. However, for some reason the restart feature is currently only available for Deployment, not for the other Resources, even though it's supported — hopefully this gets added in future updates.

Super easy config management

The Config section stores Config, Secret, and the autoscale config for the applications we're running. When you select a resource, the data in it gets listed right next to it as Key-Value pairs, and you can update it immediately, or to see the raw version of this resource, choose the pencil icon in the top-right corner.

K8s Networking is no longer a nightmare

Next is the Network section — this manages network resources in K8s, including Services, Endpoints, Ingresses, Network policies, Port Forwarding, etc.

In practice, when running applications combining a service with Ingress, you often run into errors where Ingress doesn't match the service, or service doesn't match the app, etc. But with an interface like this, you can easily check whether Ingress and service actually match correctly by looking at the info — for example, the image below is an Endpoint. If there's an Endpoint, that means the app is pointing correctly; if not, there's no application behind it handling requests.

A really neat feature is Forward Port — with just one button click, you can forward this service's port to your local machine. This feature is super useful during application debugging.

Storage for managing data

In this section you'll find info about PVs, PVCs, Storage Classes. You can edit and scale volumes easily.

Other features

Lens also supports plenty of other features, including:

  • Managing Namespaces
  • Viewing Events (Kubectl get events)
  • Installing a ready-made Helm chart with 1 click
  • Managing Access Control
  • Managing Custom Resources - CRD
  • Support for managing K8s by team
  • ...

Lens is still under active development, so there will be plenty more new features released.

Wrapping up

This tool is a very useful "IDE" for anyone just starting to poke around K8s, or for Devs without deep K8s knowledge who want to manage it easily. Hope this post helps make your work easier. Any questions, feel free to comment below — I'll answer if I can. 😁😁😁

If you're running into technical challenges or need help with systems, DevOps tools, I'm confident I can help. Get in touch at hoangviet.io.vn

Thank you all! Have a nice day!

Have thoughts on this?

I'd love to hear your perspective. Send me a message.

Get in touch