EN

K9s - Kubernetes Dashboard

A great ally in your daily routine with Kubernetes can be dashboards; in this article, we cover an "almost dashboard", learn more about this dashboard for terminal lovers.

SRE/Kubernetes Admin

Flávio Lemes

Meet your new best friend on the Kubernetes command line!

Managing Kubernetes clusters can be a challenge, but with a user-friendly CLI like K9s, you will feel like a true terminal ninja. Here are a few reasons why K9s is an excellent choice:

  • Efficient Interface: K9s offers a fast and intuitive command-line interface, allowing you to run commands and navigate your cluster as easily as scrolling through your Instagram feed.

  • Quick Access to Information: With K9s, you can quickly access detailed information about your cluster resources, such as pods, services, and deployments. It's like having an X-ray of your Kubernetes!

  • Simplified Actions: Performing complex operations, such as scaling deployments or viewing pod logs, becomes a simple and fast task with optimized commands. Goodbye, days of memorizing endless commands!

  • Productivity: A user-friendly CLI can boost your productivity by allowing administrators and developers to make changes and monitor the cluster without getting lost in a sea of commands.

Installation

Installing K9s is as easy as ordering a pizza. Let's do it!

PS: In this tutorial we will install on a MacOS environment,  K9s is available for other operating systems, you can check it out here: https://k9scli.io/topics/install/

Prerequisites:

  • Kubernetes installed and configured;

  • kubectl configured and working;


  1. Install K9s:

brew install derailed/k9s/k9s


  1. Verify the installation:

k9s version


If you see something like below, congratulations, you are on the right track:

____  __.________
|    |/ _/   __   \______
|      <


K9s uses the default context configured by kubectl, which is defined in the kubeconfig file. This file is typically located at ~/.kube/config and contains the configuration information to access one or more Kubernetes clusters.


  1. Run K9s

k9s


Exploring K9s

You can also start K9s by indicating a specific resource, such as deployments:

k9s -c deployments


In the following image we can observe the active Deployments:

To exit K9s, just use the key combination Command + C and the terminal will be freed.


Let's explore the services in the Kubernetes cluster:

k9s -c svc


And now, let's take a look at the pods, where you will have metrics such as CPU and Memory:

k9s -c pod

You can navigate the pods with the keyboard arrow keys and select a pod by pressing Enter. To return to the pod list, just press ESC.


Pros and Cons

Pros:

  • Efficiency: Fast navigation and simplified actions increase efficiency in cluster management.

  • Flexibility: K9s allows flexible cluster management, making it possible to execute custom commands and scripts.

  • Interactivity: The interactive interface allows real-time actions, such as resource scaling and troubleshooting.

  • Low Overhead: As it is a command-line tool, K9s does not consume many system resources.

Cons:

  • Learning Curve: There may be an initial learning curve for users who are not familiar with the command line.

  • Terminal Dependency: Users who prefer graphical interfaces might find the CLI less intuitive.

  • Limited Resources: Some advanced operations may not be fully supported by the CLI, requiring the use of other tools or manual commands.


Banner


Conclusion and Tips

Using K9s can transform the way you manage your Kubernetes clusters, making the process more efficient and fun. Here are some tips to get the most out of this tool:

  • Explore Shortcuts: K9s has several keyboard shortcuts that can speed up your operations. Familiarize yourself with them to increase productivity.

  • Customize the Interface: Personalize the layout and colors of K9s to best suit your preferences and needs.

  • Keep Updated: Regularly check for K9s updates to take advantage of new features and improvements.

  • Combine with other Tools: Use K9s in conjunction with other Kubernetes tools for even more robust and efficient management.

In summary, K9s is a powerful tool that can significantly improve Kubernetes cluster management, providing an intuitive interface and advanced features that simplify many daily tasks. And who doesn't like to have a bit of fun while managing clusters?!


Make sure to follow our blog, we are always sharing interesting content, and also listen to Kubicast, the podcast that brings knowledge in a different format.

Newsletter Getup.

Atualizações sobre Kubernetes e Software Supply Chain Security todos os meses.

Operating Kubernetes in production for more than 13 years. With Quor, this experience extends to software supply chain security as well.