Kubernetes Lens: Improving Operational Awareness of Kubernetes Clusters
What is Kubernetes Lens?
Kubernetes Lens is an integrated development environment (IDE) that allows users to connect and manage multiple Kubernetes clusters on Mac, Windows, and Linux platforms. It is an intuitive graphical interface that allows users to deploy and manage clusters directly from the console. It provides dashboards that display key metrics and insights into everything running on a cluster, including deployments, configurations, networking, storage, and access control.
Lens was originally developed by Finnish tech startup Kontena. In 2020, Lens was acquired by Mirantis and released as an open-source project. It is available as a free download from Github.
What Problems Does Lens IDE Solve?
Modern DevOps organizations use distributed architectures with many moving parts to create modern applications. A growing number of organizations run continuous integration / continuous delivery (CI/CD) pipelines using a set of Kubernetes clusters. The huge number of moving parts requires specialized management infrastructure including service mesh for communication management.
Kubernetes supports the “everything as code” trend. Popular CI/CD tools support Kubernetes, and new workflows are emerging, such as GitOps. However, there is currently no consensus on how to manage the Kubernetes API and streamline interactions around cluster management.
Using Kubernetes means interacting with a cluster using a CLI, which uses and retrieves YAML files that describe the state of your cluster, its resources, and applications. Managing many Kubernetes clusters can mean spanning many different platforms and bases, with different access contexts, schemas, secrets, and methods for accessing clusters, components, nodes, and infrastructure. That can quickly become very complex.
Doing all of this directly from the command line is difficult, error-prone, and time-consuming. It slows down as the number of clusters and applications grows and their configurations and requirements vary.
The concept of an integrated development environment (IDE) can help solve many of these problems. An IDE for Kubernetes can organize information and tools that help you work reliably with clusters in a variety of situations and hides unnecessary complexity by automating common tasks. This is what Lens aims to provide.
How Kubernetes Lens Improves Operational Awareness of Kubernetes Clusters
1. Cluster Management
Managing clusters in Kubernetes can be difficult, but with Kubernetes Lens, you can work on multiple clusters while maintaining context with each of them. Lens makes it possible to configure, change, and redirect clusters with one click, organizing and revealing the entire working system in the cluster while providing metrics. With this information, you can easily and very quickly edit changes and apply them confidently.
Adding a Kubernetes cluster to Lens is easy. All you need to do is point the local/online kubeconfig file to Lens and it automatically discovers and connects with it.
With Lens, you can inspect all the resources running inside your cluster, ranging from simple Pods and Deployments to the custom types added by your applications.
Try OnPage for FREE! Request an enterprise free trial.
2. Built-In Visualization and Metrics
Kubernetes Lens comes with a built-in Prometheus setup that has a multi-user feature that gives role-based access control (RBAC) for each user. That means that, in a cluster, users can only access visualizations they have permission to access.
In Lens, when you configure a Prometheus instance, it is able to display metrics and visualizations about the cluster.
After the installation, Lens autodetects Prometheus for that cluster and then begins to display cluster metrics and visualizations. You can also preview the Kubernetes manifests for Prometheus before you apply them.
With Prometheus, you get access to real-time graphs, resource utilization charts, and usage metrics such as CPU, memory, network, requests, etc., which are integrated into the Lens dashboard. These graphs and metrics are shown in the context of the particular cluster that is viewed at that moment, in real time.
That’s not all, critical alerts that indicate an anomaly in Kubernetes can be delivered to the right team owners by integrating Prometheus to OnPage via Prometheus Alertmanager. The Alertmanager handles alerts from Prometheus and routes them to OnPage’s alert management application as a loud, persistent alert, enabling the right on-call service owners to quickly respond.
Kubernetes Lens also integrates with Helm, making it easy to install and manage Helm charts and releases in Kubernetes.
3. Lens Extension
Kubernetes Lens Extensions allows you to add new and custom features and visualizations to accelerate development workflows for all the technologies and services that integrate with Kubernetes.
Kubernetes Lens also allows you to script your own extensions with the Lens APIs. They support adding new object details, creating custom pages, adding status bar items, and other UI modifications. Extensions can be published to npm to generate a tarball link that the Kubernetes Lens install screen can reference.
The Lens community has created multiple extensions that allow Lens to send metrics to alerting tools, making it possible to send notifications about production incidents in Kubernetes clusters.
4. GUI and CLI
Lens provides a way to manage Kubernetes through GUI because managing multiple clusters across various platforms and substrates means deciphering the other complexities of multiple access contexts, modes, and methods for organizing clusters, components, nodes, and infrastructure. Solving all these from the command line is difficult, slow, and fallible. This is due especially to the constant increase in the number of clusters and applications, not to mention their configurations and requirements.
With the Kubernetes Lens GUI, you can do several things:
- You can add clusters manually, by browsing through their kubeconfigs and can immediately identify kubeconfig files on your local machine.
- With Lens, you can put these clusters into workgroups in whatever way you interact with them.
- Lens provides visuals on the state of objects such as including Pods, Deployments, namespaces, network, storage, and even custom resources in your cluster. This makes it easy to identify and debug any issue with the cluster.
For the CLI lovers, Lens doesn’t leave you high and dry. You can also invoke its built-in terminal and execute your favorite kubectl command line.
Try OnPage for FREE! Request an enterprise free trial.
5. Cluster Connect
In Kubernetes, sharing access to the different clusters is difficult. When working as an administrator with different providers that require you to use the same tools, or when trying to get access to kubectl files, make those files work with your kubectl. Then connect the kubectl file to the same network with the target cluster API. However, you will need to use a VPN to be in the same network as the provider, and in some cases, you will also need to use different IAM providers. These are security risks because users might bypass security best practices.
Lens uses Cluster Connect to share access to the cluster without compromising the security of the cluster.
With Kubernetes Lens Spaces, you can send and receive invitation access to other clusters. All invitations are aggregated and then exposed to you using the Lens Kubernetes proxy. To access the clusters, you download the Cluster Connect agent in the desired cluster. The agent then allows you to connect to clusters from Lens Spaces using end-to-end encryption to secure connections between you and the clusters, eliminating the need for a VPN and the need for an inbound port to be enabled on the firewall. This also means you can access and work with their Kubernetes clusters easily from anywhere.
In this article, we introduced Kubernetes Lens and discussed five ways in which Lens can improve operational awareness in Kubernetes clusters:
- Improved cluster management – makes daily cluster management tasks easier and promotes visibility.
- Built-in visualizations – makes it possible to visualize complex cluster activities without integrating multiple tools.
- Lens extensions – provides extended functionality including the ability to send alerts to operations teams.
- GUI and CLI – intuitive web-based interface for operational tasks.
- Cluster connect – ability to discover and connect more clusters in your environment.
We hope this helps you improve daily operations for your mission critical Kubernetes clusters.