Getting started with Lens

Eric Gregory & Nick Chase - August 19, 2022
image

More than 650,000 users—and tens of thousands of organizations—rely on Lens to interact with Kubernetes clusters, whether for development, operations, or both. Lens gives users the power to build on Kubernetes clusters without worrying about complicated command-line interfaces or configuration manifests, instead providing a clear, simple graphical user interface (GUI).

But Lens is much more than a GUI, providing indispensable features including:

  • Built-in Helm, so installing a Helm chart is as simple as a click
  • Visualization for cluster activity and health
  • Security features like built-in container image scanning (for Pro subscriptions)
  • Integrated support chat for rapid assistance (for Pro subscriptions)

Today, Lens is a full-fledged Kubernetes platform, enabling you to manage multiple clusters and achieve full situational awareness for all of them. Whether you are a developer or an operator, Lens is the essential tool to reduce complexity and accelerate productivity with Kubernetes.

As of Lens 6, there are two subscription licenses available:

  • Lens Personal: This subscription is for use by individuals, education, and startups (less than $10 million in annual revenue or funding). Lens Personal subscriptions are free of charge.
  • Lens Pro: These subscriptions are required for professional use in larger businesses. The pricing is $19.90 per user / month or $199 per user / year. You may purchase a Lens Pro subscription here. Note: We are currently offering a Lens Founders’ Promotion for a 50% discount.

You can use Lens to control local clusters, or remote clusters on bare metal, private, or public clouds. If you’re working on an air-gapped cluster, that’s no problem—Lens works there, too.

Use cases for Lens

Lens provides solutions to many of the most common challenges for Kubernetes users:

  • Resource configuration and deployment: Configure, deploy, and modify Kubernetes resources in seconds
  • Troubleshooting: Inspect log streams and events in real-time, with the ability to quickly drill down into errors & warnings
  • Cluster management and monitoring: Observe multiple Kubernetes clusters with a context-aware terminal for advanced operations

Ready to get started with Lens? We’ll walk you through the setup—for most users, it should take less than five minutes.

Installing Lens

You can download the installer from the Lens website. The site will suggest the appropriate download for your system—Mac, Windows, or Linux—but you can select an alternative installer from the download button dropdown.

Run the installer and open Lens. When you first open the application, it will prompt for your Len ID.

Choose Lens ID if you already have a Lens ID or need to create one. Alternatively, you can select Activation Code to proceed with an air-gapped installation, if you have already set up an activation code.

Note: If you wish to perform an air-gapped installation but don’t have an activation code yet, you will need to create a Lens ID on an internet-connected device—you can do that on the Lens ID site, following the instructions below for new account creation.

On the next page, either log in or select Create your Lens ID.

You will need to enter a username, password, and email. Alternatively, you can authenticate with a GitHub or Google account.

You will need to verify your email, then select Add Lens Subscription.

Note: From this Lens ID management page, you will also be able to create an activation code for air-gapped installation.

Choose a Lens Personal or Lens Pro subscription. (A 30-day free trial of Lens Pro is available.)

Now you're ready to get started with Lens!

Select Open Lens Desktop to open Lens. The application will check for updates, and then you’ll be ready to get started.

Connecting to a cluster

Lens will search common directories for kubeconfig files. If you click Browse clusters in catalog on the welcome pane (or select the catalog icon in the upper right-hand corner), you may already find some clusters listed—local development clusters, for example. You can simply click on these clusters to connect to them with Lens.

To add a new cluster to the catalog, hover over the blue plus icon in the lower right-hand corner of the screen. You will have the option to add a kubeconfig directly or by syncing with a file.

Adding Helm repositories

The Helm package manager for Kubernetes is built-in to Lens, and the popular bitnami chart repository is enabled by default. To add new repositories, click Lens in your operating system taskbar menu and select Preferences. On the Preferences pane, select Kubernetes and scroll down to the Helm Charts section.

Here you can add repositories from a sizable collection or add a custom Helm repo.

Enabling Lens metrics

Lens can run a small Prometheus instance in your cluster, giving you metrics for nodes visible to you according to RBAC permissions on your account. (Admins, of course, will be able to see metrics for everything.) If you're already running Prometheus, you can export metrics from that instance to Lens.

To set up metrics, right click on the cluster icon in Lens' left-hand menu and select Settings.

On the settings pane, select Metrics to connect an existing metrics system (such as a pre-existing Prometheus instance).

Select Lens Metrics to enable a new instance. If you choose this option, Prometheus will take a minute or two to start. Press ESC to exit the Settings pane. Lens will connect to your Prometheus and cluster metrics will automagically appear on your cluster dashboard.

Basic Lens usage

Lens makes all the objects and abstractions in each cluster instantly accessible to you. Take a look at the left-hand menu, and try clicking on Workloads. You get a browsable submenu (and an alternative, tabbed display) of everything, including handy, color-coded summary graphics that will clue you to any issues.

Drill down anywhere, right-click on the submenu associated with any line-item, and you can edit its YAML in Lens' built-in editor, then Save to reapply it. Devs working with private clusters can quickly iterate live changes and check results. On shared clusters, full role-based access control (RBAC) integration helps ensure that objects on the cluster are accessed and edited only by those with the proper credentials.

Drilling in further, Lens lets you access terminals inside running containers, and retrieves container and pod logs directly, with one click, for easy review. If you're working on a more infra-as-code basis, Lens also lets you open any number of terminals, letting you quickly browse a local repo for files you need, for example, then push changes to git, issue docker commands, or pop files into VS Code (or whatever IDE or editor you prefer) for editing, versioning, and careful reapplication.

Where to go from here

Download Lens and try the 30-day free trial of Lens Pro to explore everything that Lens offers for Kubernetes users.

For inspiration on more advanced use of Lens, check out the community Slack channel (https://k8slens.slack.com).

Please try Lens, let us know what you think, and what you'd like to see covered in upcoming Lens tutorials. We're here for you!