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 offers many features required for managing Kubernetes clusters. Here are some of them…
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.
K9s provides an interactive terminal-based user interface (TUI) that makes it easier to navigate and manage your Kubernetes cluster.
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.
with just one-word commands, K9s simplifies switching between Kubernetes contexts and namespaces.
You can scale up pods, delete unwanted resources, and view service logs directly from the CLI.
Launch k9s:
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:
:ctx
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:
: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
:pf
It lists all the port forwarding entries.
Switch to services:
:svc
Get the list of all the services running.
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.