Managing Kubernetes Clusters with Lens

Managing Kubernetes Clusters with Lens

Best K8s Dashboard & IDE for DevOps

In this blog, we will learn about Lens. Lens is the best Kubernetes Dashboard and Integrated Development Environment (IDE). Lens is rightly popularised as "The Kubernetes Platform".

Pre-requisites :

Before diving into the ins and outs of the Lens IDE, it is strongly recommended to learn a bit about Kubernetes and related technologies. Here's an amazing video resource on Youtube which can be watched before learning about Lens:

Kubernetes Tutorial for Beginners | What is Kubernetes? Architecture Simplified!

Video Credits : Kunal Kushwaha

What is Lens?

Lens is the largest and most advanced Kubernetes platform in the world. It is an application that helps us to have a better look into our k8 clusters. It doesn't matter if the K8 cluster is on a local machine or it's on the cloud, Lens has got your back with all things Kubernetes. Here are a few features of Lens :

  1. Most powerful tools for developers who want to engage with Kubernetes daily via Lens Desktop
  2. We can make sure that our clusters are set up correctly and configured as per our requirements.
  3. You can increase the visibility to see what is going on inside our clusters
  4. We can get Real-Time Statistics
  5. Add your Dashboards & Charts ( Lens, Prometheus, etc. )
  6. Generate Logs
  7. Access to many hands-on troubleshooting tools
  8. Great collaborative features so that developers can connect like Cluster Connect
  9. Open Source and Free
  10. ) Removes Complexities
  11. ) Easy access to Cloud-Native Tech Stacks like Helm, Prometheus, etc
  12. ) Easy Deployment

Why Lens?

If someone is starting with K8s and want to jump straight in into the practical aspects to get to know what it is all about, Lens IDE is the best resource to use. Even a beginner can delve into Kubernetes and K8S clusters without worrying about the technical complexities of the technology. For eg, There is no need to write big YAML files or venture into CLI commands. Lens does a lot of things for us in this aspect.

For more information on Lens IDE, visit their website : Lens

Now that we know a little something about our friendly new IDE, let's download it for ourselves! Visit their website Lens, select your Operating System and download Lens Desktop. Once downloaded, install the same. Once it is installed, we can run the application on our systems

Screenshot from 2022-07-02 22-37-23.png

First time using the Lens IDE, we'll have to create our user and log in to the platform. I'd recommend using our GitHub account to log in.

This is how the home page looks :

Screenshot from 2022-07-02 22-42-55.png

As we can see. there is a catalog with a few links that we can follow. On the left panel, if we select "Clusters" then it will show our available K8S clusters :

Screenshot from 2022-07-02 22-44-36.png

Here, the minikube cluster is running on the local machine while the kube-demo cluster is running on Cloud. The Cloud Provider used for the scope of this blog is Civo. It is a cloud-native service provider which is blazing fast, simple to use, and surprisingly cheap for the services that they are providing. A question may arise, why are we even using a Cloud provider? Isn't our local machine enough? The simple answer is, that it depends on the K8S cluster. When working with multi-node systems, we would need cloud services as we would not be able to host and manage multiple nodes on our local machine.

For more information on Civo, visit their website: Civo

Here's the kube-demo cluster on the Civo Dashboard :

Screenshot from 2022-07-02 22-54-13.png

Let's get a bird's eye view of our cluster through Lens IDE, Simply clicking on the cluster will start it and the clusters can also be pinned to the left sidebar for ease of access. This sidebar is known as "Hotbar" and it makes it extremely easy to switch between running clusters. We can then click on this icon to open a dashboard that has all the statistics :

Screenshot from 2022-07-02 23-33-13.png

Two Clusters running at the same time on the Hotbar

Screenshot from 2022-07-02 23-36-04.png

Context-Aware Terminal : There's an in-built terminal in the application. We can run the following command for each of our clusters :

kubectl version

For local cluster :

Screenshot from 2022-07-02 23-38-39.png For Cloud cluster :

Screenshot from 2022-07-03 13-25-52.png

As we can see both clusters have different Git Versions. Lens is pointing to the correct cluster API endpoint. Since the clusters are running in different environments, this is different for different clusters and the terminal reflects this on its own.

By default, for the local machine, Lens IDE refers to the kube config file which has the information about how the application will connect to the K8S cluster :

Screenshot from 2022-07-02 23-43-45.png


Lens gives us options to review the information for every single node of our cluster and also run node shell for commands.

Node Information

Screenshot from 2022-07-02 23-54-03.png

Node Shell (to run commands)

Screenshot from 2022-07-02 23-54-20.png


Workload categorizes all the Kubernetes objects that we are running on a cluster.


There are a lot of features offered by Lens for pods. They can be organized using namespaces, filtered according to pod data, logs, etc.

Screenshot from 2022-07-02 23-55-30.png

Clicking on any pod displays more information related to that pod :

Screenshot from 2022-07-02 23-59-48.png

Similar layouts can be found for more Workload objects like Deployments. DaemonSets and Jobs. This interface makes it extremely easy to manage clusters.

An overview of workloads can also be viewed with information represented visually :

Screenshot from 2022-07-03 00-03-05.png

Configurations, Network & Storage

Similar to an app, we use configurations to store data in the form of key-value pairs which is essential to running the clusters. We can also have secret data. Similarly, we can view and edit network-related data like I.P. Addresses and Port numbers. We also have the storage option which lists all the storage classes, volumes, and related data like capacity and the path. All this is available via the Lens Application without having to program it ourselves.

Creating new resources for existing Clusters

Let's try to create a new pod. From the terminal bar, click the '+' symbol and select 'Create Resource'. Select Template as 'Pod'. Click 'Create & Close'. This will create the new pod which can be checked in the pod menu. Make sure you're on the correct namespace. Similarly, other resources can be created like deployments, daemonSets, etc. Resources can also be scaled as per requirements.

Screenshot from 2022-07-03 12-42-35.png

Creating cluster on Civo

Now let's create a new cluster on Civo and explore it via Lens. On your Civo Dashboard, Click on "Create new Cluster". It gives a self-explanatory and easy-to-understand form to create a cluster. You can play around with the settings and the marketplace as per the requirements and when you're ready, click on 'Create Cluster'. The Civo services are very fast and the cluster should be created in under 90 seconds.

Screenshot from 2022-07-03 12-49-39.png

Screenshot from 2022-07-03 12-53-18.png

Now let's add this cluster to Lens. From the file menu, select 'Add Cluster' or press 'Ctrl+Shift+A'. For the connection, we will download the kubeconfig file from Civo. Copy the file and paste it into Lens 'Add Cluster' section and this will connect our cluster with our IDE. We can also mention the config data in the default config file.

Nodes created on Civo:

Screenshot from 2022-07-03 12-58-27.png

Download the kube config file from the cluster dashboard on Civo.

Screenshot from 2022-07-03 12-59-17.png

Open this file and copy paster in the Add Cluster section of Lens.

Screenshot from 2022-07-03 13-00-01.png

This will add the cluster to Lens. Click on the cluster to connect it as it would be disconnected initially. You can also add it to the Hotbar for quick access.

The new cluster is added to Lens and connected:

Screenshot from 2022-07-03 13-32-02.png

Now that we have our cluster on the Lens Platform, we have endless options to configure and manage our clusters and nodes as per our needs. We can enable metrics from the settings, use Prometheus for charts, and even share the clusters via Cluster Connect for collaborative development.

Closing Thoughts and Future scope

As we saw, our life was made so easy by Lens when it comes to using and managing everything Kubernetes. It is an extremely popular platform and will only gain use in the near future. Not having to write big YAML files also saves a lot of time and effort and increases developer experience. Many things related to Lens are yet to be explored and we would definitely recommend our readers to play around with this environment as much as possible. Supporting and Contributing to Lens should also be our radars.

Credits :

Did you find this article valuable?

Support WeMakeDevs by becoming a sponsor. Any amount is appreciated!