K8S Utility 3 - Graphical UI Lens

This article was last updated on: July 24, 2024 am

Opening

📜 introduction

  • Sharpen knives and do not chop wood by mistake
  • Better tools make good work

Like me,kubectl It is not very slippery, and the following situations are often encountered:

  • Forgot the order, knock first --help, and then knock the order, inefficient
  • Forgot to add -n Specify the namespace
  • Commands that are too long are often misremembered or mistyped, for example kubectl exec -it...
  • Logs and yaml cannot be copied out quickly
  • For CRD resources, you can’t remember the CRD type and can’t find the relevant information
  • You cannot grasp the health and monitoring status of the cluster
  • The Windows machine command line is not easy to use

If your working machine (front machine, springboard machine, operating machine, bastion machine…) ) is the Windows desktop environment. Then I highly recommend you to use this K8S utility: Graphical UI Lens

📸 Introduction to Lens

Kubernetes IDE (Integrated Development Environment) for:

  • exploitation
  • debugging
  • DevOps
  • O&M
  • monitor

Lens is the only IDE you need to control your Kubernetes cluster. It is built on an open source and free basis.

Lens UI

An IDE designed for those who work with Kubernetes every day, beautiful and powerful.

💪 Lens benefits

  • 💡 Remove complexity: You don’t need to learn kubectl commands to explore and navigate Kubernetes clusters. It’s great for developers just starting out.
  • 👁️ Real-time observability: View real-time statistics, events, and log streams. There are no spins to load, refresh or wait for the screen to update.
  • 🔨 Positioning and debugging: Review the errors and warnings on the dashboard and click View Details. Click again to view the log or get the command line.
  • 💻️ Run on your PCStandalone applications on MacOS, Windows and Linux. 1 minute installation. You don’t need to install anything in the cluster.
  • 💚 Open source and free: Lens is based on an open-source platform with an active community and is supported by Kubernetes and cloud-native ecosystem pioneers.
  • Works with any Kubernetes: Using EKS, AKS, GKE, Minikube, Rancher, k0s, k3s, OpenShift…? All of them work properly. Just import kubeconfigs for the cluster you want to use.

Personal experience

Accessibility to use

Lens has oneUnified Catalog。 Bring all clusters, services, workloads, tools, automation, and related resources together for easy access.

And on Catalog, it’s easy to doBrowse and organize。 It’s easier than ever to use search, filtering, sorting, and tagging to access the resources you need to work on.

Lens Catalog

High efficiency

Lens features a column on the left called:Hotbar。 It is the main navigation that allows users to build their own “workflows” and “automations” in the desktop application. Users can customize items in Hotbar by assigning different labels, colors, and icons to facilitate recall. For example:

Lens Hotbar

It also has VSCode-like onesCommand panel。 The command palette makes the most common tasks easier by allowing users to perform specific keyboard shortcuts. Improve accessibility and efficiency when using Lens. Windows shortcuts are:Ctrl + Shift + p。 As shown in the following figure:

Lens 命令面板

Monitor consolidation

Lens Built-in visualization。 Lens integrates with Prometheus to visualize and view trends in resource usage metrics, including CPU, memory, network, and disk, through total capacity, actual usage, requests, and limits. Automatically generate detailed visualizations for each k8s resource. As shown in the following figure:

Lens CPU 内存 pod

Lens Node 监控

Lens Overview

Lens Pod 监控

All K8S resources are at your fingertips

Smart terminalsFunction. Lens smart terminals come with kubectl and helm, which automatically synchronize the version of kubectl to match the currently selected K8S cluster API version. Lens automatically assigns a kubeconfig context to match the currently selected K8s cluster.

Lens 智能终端

K8S resource templates

Comes with a full K8S resource template, and it is a template with rich information, you can directly follow the cat on the template to complete the creation of various resources, and my mother no longer has to worry about me forgetting the Spec of K8S Resources!

Lens 资源模板

Rapid deployment

Helm Chart。 Lens comes with Helm Chart Management, allowing you to discover and quickly deploy thousands of publicly available Helm Charts and manage your own repositories. Explore installed Helm Charts and revise and upgrade with a single click.

As shown in the following figure:

Lens Helm Chart 仓库

Helm Chart 一键升级

Lens Helm 已安装资源展示

Plugins!

Support plugins。 Easily add Lens extensions from communities and cloud-native ecosystem vendors or build your own. Lens Extensions are used to add custom features and services to accelerate the development process for all technologies integrated with Kubernetes and other cloud-native technologies.

Here are a few useful plugins recommended:

lens-certificate-info

View certificate information. Viewing the secret with certificate information has the following effect:

lens-certificate-info

lens-debug-tools

cooperate New features in K8S 1.16, you can insert a sidecar with a rich toolset in the pod you want to debug (in order to pursue Size, the general image is very streamlined, resulting in the lack of common commands and difficult debugging) to facilitate debugging.

You can also configure the image for debugging, and also intimately gave 3 recommendations:

Name Description Link
busybox Default value https://hub.docker.com/_/busybox
markeijsermans/debug https://hub.docker.com/r/markeijsermans/debug
praqma/network-multitool https://hub.docker.com/r/praqma/network-multitool

After the installation is complete, the pod page will have an additional button:

Lens Debug Pod 按钮

There are 2 modes:

One is “Run as debug pod”, which is to start a new pod on the same Node, which can be used to analyze and debug Node-related problems. The commands that are automatically executed are as follows:

1
kubectl run loki-promtail-5d5h8-debug -n loki-stack -it --image=busybox --restart=Never  --attach  --overrides='{ \"spec\": { \"nodeName\": \"izuf656om146vu1n6pd6lpz\" } }' --labels=createdBy=lens-debug-extension --rm

The other is the “Run as emepheral container”, which requires the new features of K8S 1.16 to be enabled. Directly start a Debug sidecar in the pod to be debugged, you can analyze and debug problems related to Node and Pod. The commands that are automatically executed are as follows:

1
kubectl debug -i -t -n loki-stack loki-promtail-5d5h8 --image=busybox --target promtail --attach

@nevalla/kube-resource-map

Resource topology diagram. This is really a favorite. Take a look at the topology diagram for Monitoring:

From Helm, to StatefulSet, to Pod, to SVC, to ConfigMap, Secret, you have it all.

Lens 拓扑图

✍ Summary.

Lens is oneKubernetes IDE, use it in a desktop environment for development, debugging, DevOps, operations, and monitoring.

It has a lot of powerful features, among them: Catalog, Hotbar, Command Palette, Monitoring, Smart Terminal, Resource Templates, Helm Chart Management, and Plugins These features must be tried and experience soaring!

Let’s use it together~ 🤓🤓🤓


K8S Utility 3 - Graphical UI Lens
https://e-whisper.com/posts/33163/
Author
east4ming
Posted on
November 25, 2021
Licensed under