Mastering Kubernetes with K9s CLI

Mastering Kubernetes with K9s CLI

What is K9s?

K9s is a command-line interface (CLI) tool. It is designed to manage Kubernetes clusters. 

Even though it is CLI tool, it provides a more efficient and user-friendly way to interact with your Kubernetes resources.

It is an alternative to the Kubectl tool which is a standard command line tool for managing Kubernetes clusters.

K9s Features | Why should you use it over kubectl?

K9s offers many features required for managing Kubernetes clusters. Here are some of them…

  1. Real-time resource monitoring: 

You can monitor the state of your Kubernetes resources in real-time. You can check the state of the resources like pods, nodes, services, secrets, and other Kubernetes cluster objects.

  1. Easy navigation through Interactive UI: 

K9s provides an interactive terminal-based user interface (TUI) that makes it easier to navigate and manage your Kubernetes cluster.

  1. Customizable views: 

As per your project demand and need, you can customize the views and layouts in K9s to suit your specific needs. This feature makes it a flexible tool for working with Kubernetes resources.

  1. Easy context and namespace switching: 

with just one-word commands, K9s simplifies switching between Kubernetes contexts and namespaces. 

  1. Efficient Kubernetes resource management: 

You can scale up pods, delete unwanted resources, and view service logs directly from the CLI.

Useful K9s Commands

Launch k9s:


Run this command on your terminal to launch the k9s interface tool. These commands open the k9s tool interface for the current context.

You can check the current context using kubectl command.

Get the list of Kubernetes context:


List open all the Kubernetes context. It is a useful command for switching between the Kubeneters context/clusters. It shows the Kubernetes clusters mentioned in the kubeconfig (Usual path to the Kubernetes config ~/.kube/config). 

Get list of all pods:


It lists down all the pods from within all namespaces and contexts.

Activate port-forward:

To set the port forwarding, select the desired pod and press shift-f.

Setting up port forwarding is useful for accessing services running within the pods.

Check all existing port-forwards


It lists all the port forwarding entries. 

Switch to services:


Get the list of all the services running.

For whom, K9s is Useful?

Since development shifted from monolithic services to microservices, demand for Kubernetes has increased. And the trend will be there for a decade or even more.

The tool K9s is particularly useful for DevOps and Kubernetes administrators who must monitor and manage their clusters effectively. 

The developer also used k9s for microservice development for testing and development. 

For developers, it enhances their productivity when working with Kubernetes, especially in complex or large-scale environments.

Leave a Reply

Your email address will not be published. Required fields are marked *