How to install Lens and connect it to your Kubernetes cluster

If you've been searching for a solid GUI to help you manage your Kubernetes clusters, look no farther than Lens. Learn how to get started with this best-in-show GUI.

How to install Lens and connect it to your Kubernetes cluster

Are you tired of trying to cobble together a UI to help manage your Kubernetes clusters? Although there are some decent GUI tools available, many of them are as much a struggle to get up and running as is the Kubernetes cluster itself. Other UIs require you to piece together numerous parts to gain any meaningful features.

That's why Miska Kaipiainen, set out to bring the once-defunct Kontena Lens back into being. And he's succeeded. Lens might well be one of the most user-friendly means of managing your Kubernetes clusters on the market. Lens features:

  • User-friendly UI/UX

  • Multi-cluster management

  • Standalone application

  • Real-time information

  • Resource utilization charts and trends

  • Terminal access to nodes and containers

  • Performance optimized for massive clusters

  • Kubernetes RBAC support

I want to walk you through the installation of Lens and show you how to connect it to your Kubernetes cluster. I'll be demonstrating with macOS, connecting it to a cluster deployed via Docker Desktop. This is more of a developer setup, but it will illustrate how the connection between Lens and cluster is made.

Lens is available for installation on Linux, macOS, and Windows. The machine you install Lens on will need to have access to your cluster, so choose that machine wisely.

SEE: Kubernetes security guide (free PDF) (TechRepublic)

How to install Lens on macOS

Installing Lens on macOS is quite simple. Download the latest .dmg file from the Lens Github page. Once the file has downloaded, double-click on the .dmg file and then on the Lens icon. This will open the installer, where you drag the Lens icon into the Applications folder (Figure A).

Figure A


Installing Lens on macOS.

How to connect Lens to your Kubernetes cluster

Lens actually makes the connection to a cluster incredibly simple--especially if you're using the tool on the machine hosting your Kubernetes cluster (or controller). Once installed, open Lens and click the Add Clusters button in the main window (Figure B).

Figure B


The Lens main window makes it easy to add a new cluster.

Lens connects to Kubernetes clusters by way of the kubconfig file. Where this is located will depend on the platform you are using. However, Lens is really good at auto-detecting your kubeconfig file. When you click the drop-down, you should see the config file listed (Figure C).

Figure C


My docker-for-desktop kubeconfig automatically shows up in the list.

Select the kubeconfig file in question and then click Add Cluster (Figure D).

Figure D


Adding the new cluster to Lens.

If your kubeconfig doesn't show up, you'll need to select Custom and then, in the resulting window, either write or paste the config file in question (Figure E).

Figure E


Adding a custom kubeconfig file to Lens.

Once you click Add Cluster, your cluster should appear in the left navigation. Click the entry to reveal all of the information and management tools available to your cluster (Figure F).

Figure F


Lens has successfully connected to your Kubernetes cluster and is ready to help you manage.

And that's all there is to installing Lens and connecting it to your Kubernetes cluster. Give this outstanding tool a go and see if it doesn't help make managing your data center Kubernetes clusters significantly easier.

Also see


Image: iStockphoto/123dartist

By Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic, The New Stack, and Linux New Media. He's covered a variety of topics for over twenty years and is an avid promoter of open source. For more news about Jack Wallen, visit his website jackwallen....