Quick Links

Lens is an advanced open-source Kubernetes dashboard which provides a graphical view into your cluster. Unlike other dashboards, Lens is an Electron-based desktop application which you install on your machine. It connects to your cluster using your existing Kubeconfig files.

Getting Lens

Pre-compiled Lens binaries are available from the project's website. There are options for Windows, macOS, and several flavors of Linux. You can pick from Debian, Fedora, Snap, and AppImage distribution formats.

Screenshot of the Lens Kubernetes dashboard

Download and run the appropriate installer. Launch Lens from your operating system's applications list to get started.

Connecting to Clusters

Lens maintains a "catalog" of clusters you can connect to. It will automatically discover your existing Kubectl connections via the files in your

        $HOME/.kube
    

directory. Click the "Browse Clusters in Catalog" button on the launch page to start a connection.

Screenshot of connecting to a Kubernetes cluster with the Lens dashboard

The Catalog displays everything Lens can inspect. Click one of the clusters in the list to view its details. Next, click the link icon in the top-right to open a connection.

Screenshot of connecting to a Kubernetes cluster with Lens

 

Lens defaults to showing a cluster overview screen that lets you visualize Kubernetes activity. You'll see metrics from your control plane and worker nodes, including graphs of CPU, memory, and pod activity. A panel further down will highlight any potential issues with your cluster.

Screenshot of the Lens Kubernetes dashboard

You can connect to new clusters by clicking the home button in the top-left to access the Catalog. Click the blue "+" button in the bottom-right to pick a

        kubeconfig
    

file to import. This lets you use arbitrary settings files you've downloaded, stored on a network share, or kept in a project repository.

Screenshot of adding a cluster connection in the Lens Kubernetes dashboard

Lens only works with Kubeconfig files and there's no graphical interface for adding a new cluster. If you want to start with a clean file, press Ctrl+Shift+A to bring up an editor. This will let you type or paste the content of a Kubeconfig file. Click the "Add clusters" button at the bottom to add the connection to your Catalog.

Using the Hotbar

Frequently used clusters can be pinned to your hotbar. This is the vertical strip of icons down the left of the window. To start with, only the Catalog is pinned to the hotbar, in the first slot. You can unpin it by right-clicking and choosing "Unpin from Hotbar".

Screenshot of editing cluster settings in the Lens dashboard

Items are pinned from within the Catalog. Click the three dots icon to the right of an item, then click "Pin to Hotbar". It'll move into the next available hotbar slot. You can rearrange your hotbar by dragging items around.

You can quickly jump between clusters in your hotbar by clicking their icons. The right-click menu exposes share, settings, and delete options to let you manage your connections. You can access these items for clusters that aren't in the hotbar by going to the Catalog, then clicking the three dots icon next to any item. The Catalog can be reached at any time by pressing Ctrl+Shift+C.

Working With Clusters

Lens provides powerful cluster management functionality which extends beyond that offered by the official web-based dashboard. You can inspect all the resources running inside your cluster, ranging from simple Pods and Deployments to the custom types added by your applications.

 

Once you've got a cluster selected, Lens shows different categories of resource in its left pane. This approach differs slightly from other dashboards which tend to offer a namespace-oriented view. In Lens you see logical groups of resources, instead of Kubernetes object names. Hence there's dropdowns for "Network", "Storage," and "Apps" in a manner that helps Kubernetes newcomers get acquainted with different resource types.

Screenshot of managing Kubernetes resources in the Lens dashboard

Once you've expanded a category you do get to see Kubernetes object types. Within "Workloads" you've got sub-views for Pods, Deployments, ReplicaSets, Jobs, and other related resources. Each resource type displays in a tabulated view which defaults to showing all items in every namespace.

You can filter the results to a single namespace using the dropdown at the top of the screen. The table also provides a searchbar and customizable columns. Click the three dots icon to the right of the header row to add or remove columns you need to see. This feature helps you focus on the information you're interested in.

Screenshot of viewing Pod logs in the Lens Kubernetes dashboard

Each item in a table has its own options too. These will vary depending on the resource type you're viewing. In the case of a Pod, you can attach to its process, get a shell inside the Pod, view its logs, or edit its manifest.

Each function brings up a new pane in the bottom panel. Most panes have their own options that let you filter the results or adjust the output's formatting. You can collapse the panel section by clicking the downwards-pointing arrow on the tab strip. The neighboring button expands the panel to fill the entire screen.

Panes open in tabs which you can freely switch between. Clicking the new tab button lets you launch a local terminal session or create a resource inside the cluster.

Screenshot of editing a Kubernetes resource using the Lens dashboard

The latter option opens a YAML editor where you can type or paste a resource manifest. Templates for popular resource types are available from the drop-down menu in the toolbar. Click "Create & Close" to add the new resource to your cluster.

Custom resource types are exposed in the the "Custom Resources" section at the bottom of the left sidebar. Submenus let you drill down into individual types and inspect the resources using each one. You can edit and delete custom resources and their types with the regular three dot menu.

Customizing Lens

Lens has several customization options accessed by pressing Ctrl+Comma. The initial settings screen lets you change the UI theme, timezone, and shell path used by local terminal instances.

Screenshot of Lens Kubernetes dashboard settings

The "Kubernetes" tab is for managing cluster operations. The first setting on this screen, "Kubectl binary download", controls the Kubectl version used by Lens. By default Lens will download a Kubectl version that's suitable for your cluster's Kubernetes release. You can disable this functionality using the green toggle button. Downloaded Kubectl releases will be added to the directory shown in "Directory for Binaries".

Screenshot of Lens Kubernetes dashboard settings

The "Kubeconfig Syncs" list defines directories which Kubectl will inspect for Kubeconfig files. Matching files will be added to your Catalog automatically. This defaults to your

        .kube
    

directory.

Screenshot of Lens Kubernetes dashboard settings

 

 

The final "Helm Charts" section lets you add new Helm repositories. You can install charts from these repositories by expanding the Apps > Charts menu in your cluster's management screen. Available charts will be displayed; select one and click "Install" to add it to your cluster.

Screenshot of installing a Helm chart with the Lens Kubernetes dashboard

 

Extensions

Lens supports extensions which can add further functionality. Press Ctrl+Shift+E to add a new extension. Enter a URL or select a downloaded extension archive from your filesystem. Press the blue "Install" button to enable the extension.

Screenshot of adding an extension to the Lens Kubernetes dashboard

 

There's currently only a handful of extensions available. They mostly focus on adding compatibility with specific vendored Kubernetes installations. There's also a Certificate Info extension which can surface certificate expiration times within the Lens interface.

You can write your own extensions too using Lens' documented 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 which Lens' install screen can reference.

Conclusion

Lens is a feature-filled graphical interface for Kubernetes clusters. It lets you work with multiple connections simultaneously and exposes all the resources inside each cluster.

Compared with other dashboards, Lens has a significant limitation as it's a desktop-bound application. You won't be able to harness its power on your mobile devices.

However this weakness is also a key strength: unlike the official dashboard, you don't need to setup proxies or expose a web service, as Lens uses your existing Kubectl config files. This makes it a safer option than running a web-based dashboard inside your cluster.

Lens is aimed at Kubernetes administrators and operations teams which need a more sophisticated management experience. Developers will feel at home too - with its Command Palette (accessed via Ctrl+Shift+P), Lens is a keyboard-friendly choice which borrows heavily from modern IDE experiences. It's a worthwhile option if you've outgrown simpler dashboards and don't want to be working with Kubectl commands and manifests.