DEV Community

Cover image for Kubernetes Lens: How To Enhance Your Kubernetes Cluster
CAST AI for CAST AI

Posted on • Originally published at cast.ai

Kubernetes Lens: How To Enhance Your Kubernetes Cluster

You probably know this feeling really well: one day you’re managing clusters like a pro, and another day you face a tornado of errors and bugs attacking you everywhere. We all love Kubernetes, but saying that it makes things a bit complicated would be an understatement. There’s a reason why solutions that make DevOps lives easier – with Kubernetes Lens among them – are popping up all over the place.

Kubernetes gives us a lot of good stuff – portability, extensibility, openness to automation, and an easier time managing containerized applications. But it has a lot of moving parts and tricky areas around scaling clusters, orchestrating storage, batch processing, and many others. Using command-line CLIs

Another problem with Kubernetes is the use of command-line interfaces (CLIs), which may overwhelm anyone used to the clarity of modern GUIs.

No wonder the market is full of tools that solve such Kubernetes-specific issues. One of them is Kubernetes Lens, a solution that has gained a lot of traction recently. What problems does it help DevOps solve, and how do you make it work? Keep reading and learn more about Kubernetes Lens.

What is Kubernetes Lens?

Kubernetes Lens is an open-source integrated development environment (IDE) for Kubernetes. It simplifies K8s management by letting cloud-native developers manage and monitor clusters in real time. 

In 2020, Mirantis purchased Lens from Kontena and later open-sourced it and made it freely available (here’s the repo). A number of Kubernetes and cloud-native ecosystem pioneers, including Apple, Rakuten, Zendesk, Adobe, and Google, support it.

A stand-alone tool that works on macOS, Windows, and various Linux distributions, Lens lets developers connect to and manage multiple Kubernetes clusters. 

It comes with a clear, user-friendly graphical interface that helps you deploy and manage clusters directly from the console. Lens also provides dashboards that deliver helpful metrics and insights into everything that happens on a cluster, such as installations, configurations, networking, storage, and access control.

The latest and most significant release of Lens is Lens 6. It has the following new features:

  • You can launch a local Minikube development environment, complete with a single-node Kubernetes cluster operating on a local virtual machine (VM). 
  • Container Security, which provides security reports on Common Vulnerabilities and Exposures (CVE) right from the Lens desktop.
  • Built-in technical help chat (available only with a premium membership).

The new version introduces a different subscription model with the following tiers:

  • Lens Personal subscription – this package is meant for personal use, education, and organizations with annual income or financing of less than $10 million.
  • Lens Pro subscription – for professional usage in large companies, $19.90 per month or $199 per year per user.
  • The licensing for the community version, OpenLens, remains unchanged, as do the upstream projects utilized by Lens Desktop.

What problems does Kubernetes Lens solve?

Cloud-native DevOps teams develop applications by iterating locally and using version control and CI/CD to push code to a sequence of Kubernetes clusters for testing, staging, and production. Clusters are built and scaled using the same tools by operators. The coordination of cluster management often becomes an issue. 

Small, task-specific clusters are prioritized above big clusters in many companies. As a result, teams end up managing a large number of clusters. The issue here is that the CLIs that interface with clusters consume lots of files, making it difficult to handle the complex and diverse set of methods and contexts. 

When scaling up apps and clusters, managing infrastructure via the command line is sluggish and error-prone. Configurations may also differ, making tracking more challenging. An IDE combines the tools and information required to deal with various settings and jobs. 

Kubernetes Lens helps in dealing with these issues by:

  • Reducing the complexity of setting cluster access and enabling you to automatically add clusters. 
  • Discovering local kubeconfig files automatically and allowing you to manage clusters across practically any infrastructure. 
  • To cope with cluster sprawl, it is now feasible to arrange a large number of Kubernetes clusters.
  • Managing various kubectl versions – Lens installs the version necessary by each cluster. 
  • Interactions with RBAC requirements are automatically restricted so that users only access resources that are authorized. 
  • Installing Prometheus instances automatically in any namespace to deliver metrics.

Key features of Kubernetes Lens

Cluster management

Adding a Kubernetes cluster to Lens is really simple: direct the local/online kubeconfig file to Lens, and it will detect and connect to it. Lens allows you to view all of the resources operating within your cluster, from simple pods and deployments to bespoke types provided by your apps.

With Kubernetes Lens, you can work on many clusters while preserving context with each of them. It organizes and reveals the complete working system in the cluster while delivering analytics, allowing you to setup, change, and reroute clusters with a single click. With this knowledge, you can make changes fast and confidently.

Lens Connector is one cool feature of Lens. It’s a built-in terminal employs a kubectl version that is API-compatible with your cluster. The terminal can identify your cluster version automatically and then assign or download the appropriate version in the background. As you transition from one cluster to another, you keep the right kubectl version and context.

User-friendly GUI 

Since managing many clusters across diverse platforms requires interpreting multiple access contexts, modes, and techniques for structuring the infrastructure, Lens provides a solution to administer Kubernetes via GUI. 

Solving all of these via the command line would otherwise be complex, time-consuming, and prone to error. This is due, in part, to the ever-increasing number of clusters and applications, as well as their configurations and requirements.

Using Kubernetes Lens GUI, you can:

  • manually add clusters by browsing through their kubeconfigs,
  • quickly find kubeconfig files on your own system,
  • organize clusters into workgroups based on how you interact with them,
  • visualize the state of objects in your cluster, such as pods, deployments, namespaces, network, storage, and even custom resources – making it simple to detect and debug any cluster issues.

And if you still enjoy using the CLI, you can use Lens’s built-in terminal to run your preferred kubectl command line.

Metrics and visualization 

Kubernetes Lens has a Prometheus configuration with multi-user functionality that provides role-based access control (RBAC) for each user. This implies that users may only view visualizations for which they have authorization.

When you configure a Prometheus instance in Lens, it offers cluster metrics and visualizations. Lens autodetects Prometheus for that cluster after installation and starts providing cluster metrics and visualizations. You may also use Prometheus to preview Kubernetes manifests before applying them.

Real-time graphs, resource utilization charts, and use data such as CPU, RAM, network, and requests are available with Prometheus and become part of the Lens dashboard. You’ll see these metrics displayed in the context of the specific cluster in real time.

Handy integrations 

Lens smoothly integrates with a wide range of Kubernetes tools. One good example is Helm, which helps you make Helm charts and releases simple to deploy and manage in Kubernetes.

You can access available Helm repositories from the Artifact Hub, which, by default, adds a Bitnami repository if no other repositories are specified. Other repositories can be added manually via the command line if necessary. 

Lens Extensions

Kubernetes Lens Extensions enable you to add new and custom features and visualizations to expedite the development processes for all Kubernetes-integrated technologies and services

Kubernetes Lens also allows you to use the Lens APIs to script your own extensions. They let you add additional object information, create custom pages, add status bar items, and make other UI changes. The Kubernetes Lens install screen can use a tarball link that extensions have uploaded to npm to produce.

Collaboration and teamwork via Kubernetes Lens Spaces

Kubernetes Lens encourages teamwork and collaboration with its Spaces feature. It's basically a location for cloud-native development teams and projects to collaborate. 

You can easily organize and access your team clusters from anywhere with a Lens space: EKS, GKE, AKS, on-premises, or a local dev cluster. Users will be able to quickly access and securely share all clusters in one space.

Kubernetes Lens alternatives to make your K8s ride even smoother

Kubernetes Lens is a powerful tool for everyone looking to get things done quickly and move on to more impactful activities. You can find even more solutions in the K8s ecosystem that streamline your work even more. 

CAST AI is an autonomous Kubernetes management platform that automates a lot of the heavy lifting around cloud infra management to make engineers more efficient. Once you onboard CAST AI, you’ll end up using Lens even less – and put cloud automation in place to do a lot of things for you.

Check out the docs to learn more about CAST AI’s capabilities around autoscaling, instance rightsizing, automated instance provisioning and decommissioning, and more.

Top comments (0)