k9s – Best Kubernetes CLI To Manage Your Clusters In Style

Posted on 266 views

How do you manage your Kubernetes cluster? Do you login to the dashboard to check out what is happening with your Pods, your network policies and the rest? That is cool but today we are on a mission to make you consider another option especially if you have a penchant for the terminal and you miss it when you are on the dashboard.

K9s provides a terminal UI to interact with your Kubernetes clusters. The aim of this project is to make it easier to navigate, observe and manage your applications in the wild. K9s continually watches Kubernetes for changes and offers subsequent commands to interact with your observed resources.

Features of k9s

  • k9s provides information At Your Finger Tips: Tracks in real-time activities of resources running in your Kubernetes cluster.
  • Standard or CRD?: Handles both Kubernetes standard resources as well as custom resource definitions.
  • Cluster Metrics: Tracks real-time metrics associates with resources such as pods, containers and nodes.
  • Power Users Welcome!: Provides standard cluster management commands such as logs, scaling, port-forwards, restart. You can also define your own command shortcuts for quick navigation via command aliases and hotkeys. What is more, there is a plugin support to extend K9s to create your very own cluster commands as well as powerful filtering mode to allow user to drill down and view workload related resources.
  • Error Zoom: Drill down directly to what’s wrong with your cluster’s resources.
  • Skinnable and Customizable: Define your very own look and feel via K9s skins. Customize/Arrange which columns to display on a per resource basis.
  • Narrow or Wide?: Provides toggles to view minimal or full resource definitions
  • MultiResources Views: Provides for an overview of your cluster resources via Pulses and XRay views.
  • k9s has your RBAC!: It supports for viewing RBAC rules such as cluster/roles and their associated bindings. Reverse lookup to asserts what a user/group or ServiceAccount can do on your clusters.
  • Built-in Benchmarking: You can benchmark your HTTP services/pods directly from K9s to see how your application fare and adjust your resources request/limit accordingly.
  • Resource Graph Traversals: K9s provides for easy traversal of Kubernetes resources and their associated resources.


K9s is multi-platform and is thus available on Linux, macOS and Windows platforms. In short there is no excuse at all not to have it running on your environment and guess what, we are going to see how to install it this very moment.

Installation of K9s

K9s as it has been mentioned in multi-platform and the following section shows how to get it installed on some popular distributions as well as on Windows and macOS. Let us begin.

Install k9s on macOS

If you are a Mac person, there is a high chance that you know Homebrew and it is through it that you will have k9s installed. As simple as homebrew is, the following is the only command you will need to run.

brew install k9s

Via Homebrew for macOS or LinuxBrew for Linux

If you want, you can use MacPorts for the same. The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac operating system.
Via MacPorts

sudo port install k9s

Install On Arch Linux / Manjaro

To get k9s on your favorite Arch Linux computer, pacman has that for you. Simply run the command below:

pacman -S k9s

Install k9s on OpenSUSE Linux distribution

Well, well, well OpenSUSE guys! You are totally covered here as well. Get K9s installed via your pretty zypper as follows.

zypper install k9s

Install k9s on Windows

Installing k9s on Windows is as straightforward as you can imagine. You can either use Scoop or my favorite Chocolatey.

Via Scoop for Windows

Install k9s through Scoop as follows

scoop install k9s

Via Chocolatey for Windows

Install k9s through Chocolatey as follows

choco install k9s

In case you do not have Chocolatey, you can check out Manage Windows Applications from Command Prompt (CLI) with Chocolatey guide.

Install k9s Via a GO install

The dev version of k9s will be in effect!

go get -u github.com/derailed/k9s

You can also build K9s from Source

K9s is currently using go v1.14 or above. Install Go v1.15.2 as follows on Linux.

wget https://golang.org/dl/go1.17.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xf go1.17.1.linux-amd64.tar.gz
$ vim ~/.bash_profile
export PATH=$PATH:/usr/local/go/bin

Then source the file to persist the configuration.

source ~/.bash_profile

In order to build K9 from source you must Clone the repo first before proceeding.

cd ~
git clone https://github.com/derailed/k9s.git
cd ~/k9s

Build and run the executable

$ make build && ./execs/k9s
go: downloading k8s.io/client-go v0.18.8
go: downloading k8s.io/apimachinery v0.18.8
go: downloading k8s.io/metrics v0.18.8
go: downloading gopkg.in/yaml.v2 v2.2.8
go: downloading k8s.io/api v0.18.8
go: downloading k8s.io/klog v1.0.0
go: downloading github.com/sahilm/fuzzy v0.1.0
go: downloading github.com/gdamore/tcell v1.3.0
go: downloading github.com/derailed/popeye v0.8.10
go: downloading github.com/hashicorp/golang-lru v0.5.1
go: downloading sigs.k8s.io/structured-merge-diff/v3 v3.0.0
go: downloading github.com/fvbommel/sortorder v1.0.1

When it is done, you should see an interface as shared below.


As you can notice, there is no Kubernetes cluster information captured by k9s when it launches which brings us to the next important step.

Adding Kubernetes config file for K9s

The good news about k9s is that it looks at the default directory where kubeconfig file is usually located. And that is at “~/.kube“. If you have the kubeconfig file of your cluster, simply create that directory and copy the config file in it.

mkdir ~/.kube
cp config ~/.kube

After that, you can launch k9s and we are sure that your face will twist to a satisfied smile when you see the details of your Kubernetes cluster captured meaning that K9s has connected to your cluster. Whilst inside k9s cloned files, run the exec command once again:

cd ~/k9s


Using K9s

Now, after you have already setup your K9s and it has successfully connected to Kubernetes, there are a couple of keyboard shortcuts you can use to start interacting with your cluster.

Show all pods

If you would wish to show all of your pods in all namespaces, there is a simple keyboard key you press. You simply press zero (0) and all of your pods will be shown as illustrated below.


Show logs of a pod

To show logs of a given pod, you will be required to highlight it using up/down keyboard keys then hit letter “l” for logs. Quite intuitive! Logs generated by the pod will trickle down as shown below.


Once you are done viewing the logs and you would wish to go back, hit escape “esc” keyboard key.

Show Aliases

Aliases make your life a lot easier when you want to execute multiple Kubernetes commands in one session. To view your aliases, use (Ctrl+a) keyboard combination.


Exec into a pod

Another well-thought feature that k9s comes with out of the box is its ability to shell into a pod using one keyboard key. It really makes your work as easy as it can get. To shell into pod, highlight it using the up/down keys then hit “s” key.

Describe a Pod

Describing a pod presents comprehensive information/details about the resource if you would wish to investigate its configuration. K9s simplifies this process by reducing the work to pressing one key as it does with other functionalities. To describe your pod, highlight it using up/down keyboard keys then press “d” keyboard key.


Show all keys (Help)

To view all of the keys at your disposal in a nutshell, there is one key you need to press and that is the question mark (?). And you will have a display of helpful keys as shared on the screenshot below.



Managing your Kubernetes cluster has never been as easy and as fun as using k9s. There is a lot more that it can do apart from what has already been covered in this guide. You can delete kubernetes resources, check the metrics of your cluster and much more. For more details about this tool, check out its official GitHub page.

That being said, it is time to thank you for visiting and hanging on till the end and we hope what has been shared above has been helpful.


Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.