From time to time, one might want to go and inspect the k3s cluster included in the UMH.
While kubectl is the default command-line tool for interacting with Kubernetes, there are several alternative methods that can make cluster management more efficient and user-friendly. In this article, we’ll explore four ways to manage Kubernetes clusters.
Using k9s
k9s is a terminal-based UI that provides a more interactive way to interact with your Kubernetes clusters. It’s especially useful for those who prefer working within the terminal but want a more visual and navigable interface than kubectl
offers.
Installation
To install k9s on a United Manufacturing Hub (UMH) instance, run the following commands:
curl -sS https://webinstall.dev/k9s | bash
sudo ~/.local/bin/k9s --kubeconfig /etc/rancher/k3s/k3s.yaml
Note: For Flatcar Linux, the installation commands might differ slightly.
Usage
k9s operates similarly to vim
, so if you're familiar with vim
shortcuts, you'll find k9s intuitive. If not, it might take some time to get used to. Here are some basic commands:
- Navigation: Use arrow keys to navigate through resources.
- Command Mode: Press
:
to enter command mode, then type commands likedeployments
to view deployments. - Resource Details: Select a resource and press
Enter
to view its details.
For more information, visit the k9s documentation.
Using OpenLens
OpenLens is an open-source fork of Lens, providing a comprehensive UI for managing Kubernetes clusters. It's a desktop application available for Linux, macOS, and Windows.
Installation
Download OpenLens from its GitHub repository and follow the installation instructions for your operating system.
Note: The OpenLens project has halted development due to the original Lens source code being closed. You might encounter some bugs.
Lens Desktop
An alternative to the OpenLens project is Lens Desktop, which continues to receive active development. Lens Desktop offers a comprehensive UI for managing Kubernetes clusters and is available for Linux, macOS, and Windows. However, it’s important to note that Lens Desktop is no longer open-source, as the source code has been closed by its developers. This change has left some users with a slightly negative impression due to concerns about transparency and community involvement.
Using the Command Line
The command line remains the fundamental way to manage Kubernetes clusters, especially when you need direct access or are scripting tasks.
Accessing the Cluster
SSH into your UMH instance:
ssh user@your-instance-ip
Executing Commands
Use kubectl
commands with appropriate permissions:
sudo $(which kubectl) logs -f united-manufacturing-hub-timescaledb-0 -n united-manufacturing-hub --kubeconfig /etc/rancher/k3s/k3s.yaml
Explanation: This command tails the logs of the timescaledb-0
pod in the united-manufacturing-hub
namespace.
For more examples and detailed commands, refer to our documentation.
Using Headlamp
Headlamp is a web-based Kubernetes UI focused on extensibility and user-friendliness. It's a relatively new tool that offers a clean interface for cluster management.
Installation
You can install Headlamp locally on your machine or deploy it within your Kubernetes cluster. Visit the Headlamp website for installation instructions.
Feedback
Since Headlamp is a newer tool and hasn't been extensively tested by our team, we welcome any feedback or recommendations. Please share your experiences in our Discord channel.
Managing Kubernetes clusters doesn't have to be limited to kubectl
. Tools like k9s, OpenLens, and Headlamp offer alternative ways to interact with your clusters, each with its own set of features and benefits. Whether you prefer a terminal-based UI, a desktop application, or a web-based interface, there's a tool that fits your workflow.
If you have any questions or need further assistance, feel free to reach out through our community channels.