Photo by KOBU Agency / Unsplash

How to Navigate your Kubernetes Cluster using Mirantis Lens

Prince Onyeanuna
Prince Onyeanuna

Table of Contents

Have you ever tried deploying a microservice application only to hit a network issue that sends you into debugging mode? After rounds and rounds of kubectl get podskubectl describe service, and kubectl logs, you finally find what's going on, and you go again into more commands to fix this issue.

After doing this for probably a few hours, you might get frustrated and either give up on the project or take a really long break to recoup.

Now, this has been the norm for platform engineers and basically anyone working with Kubernetes via the CLI - which is usually the most used way of working with Kubernetes. Until, however, Lens came into the Picture.

Lens allows you to view your Kubernetes clusters and actively work on them via a Graphic User Interface (GUI) like you would a normal codebase.

In this article, we'll introduce you to Lens and use its demo cluster to show you how to navigate and manage your Kubernetes clusters. By the end of this article, you'll have a fancier way of managing your clusters without reading through lines of commands on a plain screen.

What is Lens?

Lens is a Kubernetes IDE that allows you to manage your Kubernetes clusters via a GUI. It is a standalone application that runs on your local machine and connects to your Kubernetes clusters via the Kubernetes API.

Lens is a free and open-source project developed by Mirantis, a company that provides a Kubernetes platform for enterprises. It is a great tool for platform engineers, developers, and anyone working with Kubernetes, as it provides a visual way to interact with your Kubernetes clusters.

With Lens, you can monitor cluster health, manage resources, and troubleshoot issues all in one place without needing to memorize countless kubectl commands. It's like having a high-tech cockpit for your Kubernetes environment, making cluster management more intuitive and efficient.

Installing Lens

To install Lens, visit the Lens Website, where you can find the installation instructions for your operating system.

Once you have downloaded the application, you can install it on your local machine by following the installation instructions for your operating system.

Figure 1: Download Lens

After installing Lens, you can launch the application and connect it to your Kubernetes clusters.

Figure 2: Lens Dashboard

To navigate your Kubernetes cluster with Lens, you need to connect Lens to your Kubernetes cluster. You can do this by adding your kubeconfig file to Lens.

The kubeconfig file contains the configuration information for your Kubernetes cluster, including the cluster name, server URL, and authentication details.

Adding a new cluster 

To add a new cluster in Lens, right-click on Local Kubeconfigs and select the Add Kubeconfigs button in the Lens dashboard. This will allow you to select your kubeconfig file from your local machine.

Figure 3: Add Cluster

Once you have connected Lens to your cluster, you can start exploring your cluster using the Lens dashboard. However, for this article, we will use the demo cluster available in Lens to show you how to navigate and manage your Kubernetes clusters.

Just like you would navigate a codebase in an IDE, you can navigate your Kubernetes cluster in Lens. You can view the resources in your cluster, such as pods, deployments, services, and configmaps. You can also view the logs, events, and metrics for each resource.

The first thing you'll see when you access your cluster on Lens is the Overview tab, which shows an overview of your cluster. The overview displays the usage of resources like CPU, memory, and Pods.

Figure 4: Lens Overview

Right below the overview is the Applications tab, which shows the applications running in your cluster. In this tab, you can view the Namespace, Name, and Status of each application. For the demo cluster, there is no application running, so the list is empty. However, when you deploy an application to your cluster, it will appear in this tab.

Figure 5: Applications

The Nodes tab shows the nodes in your cluster. You can view the Name, Status, and Resource usage for each node. On each node, you can perform certain actions by clicking on the three-dots on the right side of the node. In that dropdown, you can choose to edit, delete, or access the node via the terminal.

Figure 6: Nodes

The next tab is the Workloads tab, which shows the workloads running in your cluster. You can view the Namespace, Name, and Status of each workload. Workloads include resources like Pods, Deployments, StatefulSets, and DaemonSets, etc.

Figure 7: Workloads

The Config tab shows the configuration resources in your cluster. You can view the Namespace, Name, and Status of each configuration resource. Configuration resources include resources like ConfigMaps, Secrets, and HorizontalPodAutoscalers, etc.

Figure 8: Config

The Network tab shows the network resources in your cluster. You can view the Namespace, Name, and Status of each network resource. Network resources include Services, Ingresses, network Policies, etc.

Figure 9: Network

The Storage tab shows the storage resources in your cluster. You can view the Namespace, Name, and Status of each storage resource. Storage resources include persistent volumes, Persistent Volume Claims, and Storage Classes.

Figure 10: Storage

The next tab is the Namespaces tab, which shows the namespaces in your cluster. You can view the Name, Labels, and Status of each namespace. Namespaces are used to organize resources in your cluster and provide a way to divide cluster resources among multiple users or teams. With each namespace, you have the option to edit or delete the namespace.

Figure 11: Namespaces

The Events tab shows the events in your cluster. You can view the Type, Source, and Message of each event. Events provide information about the state of your cluster and can be used to troubleshoot issues.

Figure 12: Events

Right below the events tab is the Helm tab, which shows the Helm releases in your cluster. This tab lets you view the available Helm releases' Names, Descriptions, and Repositories.

Figure 13: Helm

The Access Control tab shows the access control resources in your cluster. You can view the Namespace, Name, and Age of each access control resource. Access control resources include Roles, Role Bindings, Cluster Roles, Cluster Role Bindings, and Service Accounts.

Figure 14: Access Control

And just in case you were itching to use the terminal, right at the bottom of the Lens dashboard, you have a Terminal tab. This tab allows you to access the terminal for your cluster. You can run kubectl commands in the terminal and interact with your cluster using the command line.

Figure 15: Terminal

The + button at the bottom right corner of the Lens dashboard allows you to create new resources in your cluster. You can create resources like Pods, Deployments, Services, ConfigMaps, and more by clicking on this button and simply selecting a Template for the resource you want to create.

Figure 16: Createa a new resource

Conclusion

In this article, we introduced you to Lens, a Kubernetes IDE that allows you to manage your Kubernetes clusters via a GUI. We showed you how to install Lens on your local machine and connect it to your Kubernetes clusters. We also showed you how to navigate your Kubernetes cluster using the Lens dashboard and explore the resources in your cluster.

If you've ever used an IDE and are familiar with Kubernetes, then Lens can be a great tool to 2x your productivity. So, the next time you hit a network issue in your microservice application, you can use Lens to quickly identify and fix the issue without needing to go through the back and forth of kubectl commands.

Kubernetes

Prince Onyeanuna Twitter

Prince is a technical writer and DevOps engineer who believes in the power of showing up. He is passionate about helping others learn and grow through writing and coding.