DEV Community

Shiivam Agnihotri
Shiivam Agnihotri

Posted on

Exploring K9s - A Terminal UI to Manage Your Kubernetes Clusters : Day 23 of 50 days DevOps Tools Series

Welcome to Day 23 of our "50 DevOps Tools in 50 Days" series. Today, we delve into K9s, an exceptional terminal UI for managing Kubernetes clusters. K9s simplifies cluster management by providing a user-friendly and efficient way to navigate, inspect, and manage Kubernetes resources directly from the command line.

What is K9s?

K9s is an open-source terminal user interface that allows you to interact with your Kubernetes clusters in a more intuitive and efficient manner. It provides real-time updates and a streamlined way to manage resources without leaving your terminal.

Why Use K9s?

K9s offers several advantages that make it a valuable tool for Kubernetes management.

Intuitive Navigation: Easily navigate through different Kubernetes resources and namespaces.
Real-time Monitoring: View real-time metrics and logs for your pods and other resources.
Resource Management: Perform CRUD operations (Create, Read, Update, Delete) on your resources.
Efficiency: Save time by managing your clusters directly from the terminal without needing to switch between multiple tools and interfaces.

Installing K9s

K9s can be installed on various platforms, including macOS, Linux, and Windows. Here are the installation methods for each platform:

macOS
You can install K9s using Homebrew:

brew install derailed/k9s/k9s
Enter fullscreen mode Exit fullscreen mode

Linux
Download the latest K9s binary from the releases page and move it to your executable path:

wget https://github.com/derailed/k9s/releases/download/v0.24.15/k9s_Linux_x86_64.tar.gz
tar -xvf k9s_Linux_x86_64.tar.gz
sudo mv k9s /usr/local/bin/
Enter fullscreen mode Exit fullscreen mode

Getting Started with K9s

Once K9s is installed, you can start it by simply running:

k9s
Enter fullscreen mode Exit fullscreen mode

This command will launch the K9s UI in your terminal, providing an overview of your current Kubernetes context and resources.

Navigating K9s

Here are some key navigation commands in K9s:

:namespace: List and switch between namespaces.
:pod: View and manage pods in the current namespace.
:svc: View and manage services.
:deploy: View and manage deployments.
Ctrl + a: View all resources in the current namespace.
Ctrl + g: Jump to a specific resource.
q: Quit the current view or exit K9s.

Performing Operations in K9s

K9s allows you to perform various operations on your Kubernetes resources.

View Logs: Select a pod and press l to view its logs.
Describe Resource: Select a resource and press d to describe it.
Edit Resource: Select a resource and press e to edit it.
Delete Resource: Select a resource and press x to delete it.
Exec into Pod: Select a pod and press s to exec into it.

Customizing K9s

K9s is highly customizable, allowing you to tailor the interface to your needs. You can create custom views, modify resource listings, and configure key bindings. Configuration files are stored in the $HOME/.k9s directory.

Benefits of Using K9s

Enhanced Productivity: K9s streamlines cluster management, reducing the time spent switching between tools.
Improved Visibility: Real-time monitoring and metrics provide better insights into the state of your clusters.
Ease of Use: The intuitive UI and powerful features make it easier to manage complex Kubernetes environments.
Flexibility: K9s supports a wide range of Kubernetes resources and operations, making it a versatile tool for any DevOps engineer.

Limitations of K9s

While K9s is a powerful tool, it has some limitations:

Terminal-based: Being a terminal UI, it may not appeal to those who prefer graphical interfaces.
Learning Curve: Although intuitive, new users might need some time to get accustomed to the commands and navigation.

Conclusion

K9s is a robust and efficient tool for managing Kubernetes clusters directly from the terminal. Its real-time monitoring, intuitive navigation, and powerful resource management capabilities make it an indispensable tool for any DevOps engineer working with Kubernetes. By integrating K9s into your workflow, you can enhance your productivity, gain better visibility into your clusters, and simplify resource management.

Stay tuned for more exciting tools in our "50 DevOps Tools in 50 Days" series. After two more articles we shall move on different DevOps Tool.

👉 Make sure to follow me on LinkedIn for the latest updates: Shiivam Agnihotri

Top comments (0)