DEV Community

Cover image for Installing K9s: A Comprehensive Tutorial
Faaiq Amarullah
Faaiq Amarullah

Posted on

Installing K9s: A Comprehensive Tutorial

📘 What is K9s?

K9s is an open-source, terminal-based UI designed to help you interact with your Kubernetes clusters. It provides a real-time view of all your resources—pods, deployments, services, CRDs, and more—right from your terminal. K9s simplifies cluster management by offering quick keyboard shortcuts and intuitive navigation, allowing you to troubleshoot and operate clusters faster than with kubectl alone.


⚖️ Why K9s?

Before we dive into the installation, let's briefly highlight why k9s has become an indispensable tool for many DevOps practitioners:

  • Real-time Monitoring: Get live insights into your cluster's health, resource utilization, and pod statuses.
  • Intuitive Navigation: Easily browse through namespaces, deployments, services, pods, and more with a simple keyboard-driven interface.
  • Log Aggregation: View container logs in real-time, filter them, and even follow specific logs.
  • Resource Management: Perform common operations like scaling deployments, deleting pods, and editing resources directly from the UI.
  • Context Switching: Seamlessly switch between multiple Kubernetes contexts and clusters.
  • Search and Filter: Quickly find specific resources using powerful search and filtering capabilities.
  • Port Forwarding: Set up and manage port forwards for easy access to your applications.
  • Customization: Tailor k9s to your preferences with custom hotkeys and configurations.

In essence, k9s empowers you to spend less time typing kubectl commands and more time understanding and managing your Kubernetes environments.


🧰 Prerequisites

Before installing K9s, make sure you have:

  • Access to a Kubernetes cluster (e.g., Minikube, Kind, EKS, GKE, AKS)
  • kubectl installed and configured
  • A valid kubeconfig file (usually in ~/.kube/config)

⚙️ Installing K9s

🔧 Method 1: Automatic Installation Via Webi (Recommended)

For Linux and macOS:

curl -sS https://webinstall.dev/k9s | bash
Enter fullscreen mode Exit fullscreen mode

For Windows:

curl.exe -A MS https://webinstall.dev/k9s | powershell
Enter fullscreen mode Exit fullscreen mode

Note: Restart your terminal after the installation is complete.

 

🔧 Method 2: Manual Installation (For Linux and macOS)

1. Download the latest version (replace with the latest version tag):

# For Linux
curl -LO https://github.com/derailed/k9s/releases/download/v0.50.6/k9s_Linux_amd64.tar.gz

# For macOS
curl -LO https://github.com/derailed/k9s/releases/download/v0.50.6/k9s_Darwin_amd64.tar.gz
Enter fullscreen mode Exit fullscreen mode

2. Extract the archive:

# For Linux
tar -xzf k9s_Linux_amd64.tar.gz

# For macOS
tar -xzf k9s_Darwin_amd64.tar.gz
Enter fullscreen mode Exit fullscreen mode

3. Move the binary to your PATH:

sudo mv k9s /usr/local/bin/
Enter fullscreen mode Exit fullscreen mode

4. Verify the installation:

k9s version
Enter fullscreen mode Exit fullscreen mode

 

🔧 Method 3: Manual Installation (For Windows)

1. Download the binary:

    Go to K9s Releases and download the k9s_Windows_amd64.tar.gz.

2. Extract using 7-Zip or similar.

3. Move k9s.exe to a directory in your system PATH, e.g., C:\Program Files\k9s.

4. (Optional) Add the path:

    - Hit Win+r and type sysdm.cpl
    - Go to "Advanced" tab and click "Environment Variables"
    - Edit Path under "System variables"
    - Add the directory where k9s.exe is located

5. Verify:

k9s version
Enter fullscreen mode Exit fullscreen mode

🚀 How to Use K9s?

Once installed, just type:

k9s
Enter fullscreen mode Exit fullscreen mode

This launches an interactive UI in your terminal.

K9s Screenshoot Pod

K9s Screenshoot Deployment

K9s Screenshoot Describe Deployment

K9s Screenshoot Logs Deployment


🧭 Common Keyboard Shortcuts

Key / Command Function
Arrow Keys (Up/Down/Left/Right) Navigate lists and views
Enter View details of a selected resource (e.g., list deployment's pod, list pod's container)
Esc Go back to the previous view
/ Search resources (e.g., /nginx)
: Switch resource views (e.g., :pod, :deploy, :service)
e Edit selected resource manifest
d Describe selected resource
Ctrl+d Delete selected resource
l View logs of a pod
s Shell into the selected pod
y Show YAML manifest
0 Switch to all namespace view
? Show help
Ctrl+c Quit

🔐 K9s and Kubernetes Security (RBAC)

K9s uses your kubeconfig credentials and respects any RBAC policies in place. If a resource is restricted based on your cluster permissions, K9s will reflect that. Ensure your service account or IAM role has the necessary get, list, watch, and delete permissions.


📚 Resources


✅ Conclusion

K9s is a must-have tool in any Kubernetes practitioner's toolkit. With its cross-platform support and real-time UI, managing your cluster becomes significantly faster and more intuitive.

No need to memorize dozens of kubectl commands—K9s gives you a live window into your cluster that fits right inside your terminal.

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.