How to Install K9s (Kubernetes CLI) on Linux


In this article, we will see how to install k9s (Kubernetes CLI) on Linux to manage Kubernetes Clusters. K9s is a powerful command-line interface (CLI) tool designed to simplify and enhance the interaction with Kubernetes clusters. It provides a terminal-based user interface, enabling developers and system administrators to manage and observe Kubernetes resources and their status more efficiently. K9s streamlines the workflow with Kubernetes, making it more accessible and user-friendly, especially for those who prefer working within a terminal environment. Here we will see how to install K9s (Kubernetes CLI) on Linux.


Key Features

a) Interactive Interface: K9s offers a text-based user interface that is interactive and easy to navigate. It displays Kubernetes resources in a well-organized and readable format.

b) Real-Time Monitoring: One of the standout features of K9s is its ability to monitor Kubernetes resources in real-time. This allows users to observe the live status of their cluster, including pods, nodes, deployments, and more.

c) Resource Management: With K9s, users can perform various resource management tasks such as viewing, creating, updating, and deleting Kubernetes resources directly from the interface.

d) Logs and Debugging: K9s provides easy access to logs of Kubernetes pods, making it simpler to troubleshoot issues. Users can tail logs of multiple pods and containers for real-time monitoring.

e) Filtering and Searching: The tool allows users to filter and search for specific Kubernetes resources, which can be particularly useful in large clusters with numerous resources.

f) Port Forwarding and Shell Access: K9s supports port forwarding to Kubernetes pods and provides shell access for direct interaction with containers, enhancing debugging and interaction capabilities.

g) Customizable and Extensible: Users can customize the tool's behavior and appearance to suit their preferences. K9s also supports plugins, allowing for further extensibility.

h) Kubernetes Context Management: It allows users to switch between different Kubernetes contexts easily, which is helpful when managing multiple clusters.

i) Shortcut Keys: K9s offers numerous keyboard shortcuts for common tasks, increasing efficiency and reducing the need for typing long kubectl commands.


How to Install K9s (Kubernetes CLI) on Linux

How to Install K9s (Kubernetes CLI) on Linux

Also Read: How to Install latest version of Golang(Go) in Linux

Step 1: Prerequisites

a) You should have a running Linux System.

b) You should have sudo or root access to run privileged commands.

c) You should have wget or curl utility available in your Server.

d) You should have atleast GO v1.20 or above installed in your System.

e) You should also have make utility installed in your System.


Step 2: Update Your System

Before installing K9s in your system, it is recommended to check and install all the latest available updates to keep your server safe and secure from any potential vulnerabilities and bugs. If you are using ubuntu or debian based linux then you can update packages by running sudo apt update && sudo apt upgrade command as shown below.

sudo apt update && sudo apt upgrade

If you are using RHEL or CentOS or Fedora based linux then you can update packages by running either sudo yum update && sudo yum upgrade or sudo dnf update && sudo dnf upgrade command as shown below.

sudo yum update && sudo yum upgrade
sudo dnf update && sudo dnf upgrade


Step 3: Download K9s

You have to visit GitHub website and download the latest version of K9s using any of the file downloader utility such as wget or curl utility. Here we are downloading the file using wget utility as shown below. Below command download the tarball in current working directory.

cyberithub@ubuntu:~$ wget
--2023-12-16 22:52:34--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: [following]
--2023-12-16 22:52:35--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘v0.29.1.tar.gz’

v0.29.1.tar.gz [ <=> ] 6.39M 3.26MB/s in 2.0s

2023-12-16 22:52:37 (3.26 MB/s) - ‘v0.29.1.tar.gz’ saved [6702839]



Step 4: Extract File

To extract files from tarball, run tar -xzvf v0.29.1.tar.gz command as shown below. This will create a directory called k9s-0.29.1 in current location and extract all files in it.

cyberithub@ubuntu:~$ tar -xzvf v0.29.1.tar.gz



Step 5: Build Files

Then switch to directory using cd k9s-0.29.1 command and build all the files using make build command as shown below. This command will read build rules from Makefile and execute all the steps as per the defined rule. You have to patiently wait for sometime to complete the build step.

cyberithub@ubuntu:~$ cd k9s-0.29.1/
cyberithub@ubuntu:~/k9s-0.29.1$ make build
fatal: not a git repository (or any of the parent directories): .git
go: downloading v0.28.4
go: downloading v2.110.1
go: downloading v0.1.13
go: downloading v1.31.0
go: downloading v1.8.0
go: downloading v2.4.0
go: downloading v0.28.4
go: downloading v1.3.0
go: downloading v1.1.0
go: downloading v0.28.4
go: downloading v0.28.4
go: downloading v0.28.4
go: downloading v0.4.0
go: downloading v2.3.1-rc.3
go: downloading v0.8.2
go: downloading v1.7.0
go: downloading v0.0.15
go: downloading v0.1.0
go: downloading v0.14.0
go: downloading v0.1.4



Step 6: Check Version

After running successful build, you can check the current installed version by running ./execs/k9s version command as shown below.

cyberithub@ubuntu:~/k9s-0.29.1$ ./execs/k9s version
 ____   __.________
|    |/ _/   __    \______
|      < \____     / _ __/
|    | \     /    /\___ \
|____|__ \ /____//____   >
        \/            \/

Version: v0.29.0
Date: 2023-12-17T07:52:47Z


Step 7: Execute K9s

To execute and start k9s terminal, you can run ./execs/k9s command. This will start the CLI which can then further be used to manage your Kubernetes Cluster.

cyberithub@ubuntu:~/k9s-0.29.1$ ./execs/k9s


Step 8: Check all available options

To check all the options available with k9s utility, you can use ./execs/k9s --help command as shown below.

cyberithub@ubuntu:~/k9s-0.29.1$ ./execs/k9s --help
K9s is a CLI to view and manage your Kubernetes clusters.

k9s [flags]
k9s [command]

Available Commands:
completion    Generate the autocompletion script for the specified shell
help          Help about any command
info          Print configuration info
version       Print version/build info

  -A, --all-namespaces                Launch K9s in all namespaces
      --as string                     Username to impersonate for the operation
      --as-group stringArray          Group to impersonate for the operation
      --certificate-authority string  Path to a cert file for the certificate authority
      --client-certificate string     Path to a client certificate file for TLS
      --client-key string             Path to a client key file for TLS
      --cluster string                The name of the kubeconfig cluster to use
  -c, --command string                Overrides the default resource to load when the application launches
      --context string                The name of the kubeconfig context to use
      --crumbsless                    Turn K9s crumbs off
      --headless                      Turn K9s header off
  -h, --help                          help for k9s
      --insecure-skip-tls-verify      If true, the server's caCertFile will not be checked for validity
      --kubeconfig string             Path to the kubeconfig file to use for CLI requests
      --logFile string                Specify the log file (default "/tmp/k9s-cyberithub.log")
  -l, --logLevel string               Specify a log level (info, warn, debug, trace, error) (default "info")
      --logoless                      Turn K9s logo off
  -n, --namespace string              If present, the namespace scope for this CLI request
      --readonly                      Sets readOnly mode by overriding readOnly configuration setting
  -r, --refresh int                   Specify the default refresh rate as an integer (sec) (default 2)
      --request-timeout string        The length of time to wait before giving up on a single server request
      --screen-dump-dir string        Sets a path to a dir for a screen dumps
      --token string                  Bearer token for authentication to the API server
      --user string                   The name of the kubeconfig user to use
      --write                         Sets write mode by overriding the readOnly configuration setting

Use "k9s [command] --help" for more information about a command.

Leave a Comment