K9s
K9s is a terminal interface for inspecting and managing Kubernetes clusters through the active kubeconfig.
Why consider K9s?
A terminal UI for navigating, observing, and managing Kubernetes clusters.
Learn K9s by building
Practical setup notes, real use cases, and copy-ready examples in one focused guide.
In this guide2 sections
Interacting with Kubernetes Clusters via K9s
K9s is a terminal-based UI for interacting with Kubernetes clusters. Rather than relying on repetitive kubectl commands to inspect resources and identify issues, K9s continually watches Kubernetes for changes and presents cluster activity through an interactive console. It monitors Kubernetes resources in real-time and provides commands to interact with them, ensuring that the displayed state remains synchronized with the cluster. K9s handles standard Kubernetes resources as well as Custom Resource Definitions (CRDs), allowing operators to view third-party workloads using the same interface.
The interface tracks real-time metrics for pods, containers, and nodes, enabling operators to drill down into cluster errors directly from the terminal without continuously querying the API. By continuously watching the cluster, K9s eliminates the latency of repeatedly executing manual queries to check pod statuses or read event streams. The visual representation highlights failing workloads, allowing administrators to detect deployment issues immediately. Through its UI, K9s supports standard cluster management tasks like viewing logs, scaling, port-forwarding, and restarting pods. When investigating an error, operators can navigate from a deployment down to an individual pod, examine its logs, and view its configuration without leaving the terminal view.
Installation and Startup Arguments
K9s runs as a standalone client on operators' local machines and uses existing Kubernetes configuration files for cluster access. It is available for installation on macOS, Linux, and Windows using package managers like Homebrew, Snap, and Scoop. For example, to install K9s on macOS or Linux via Homebrew, run the following command:
brew install derailed/k9s/k9sFor environments where local binaries are restricted or when testing a specific release, you can run K9s as a Docker container, mounting the default KUBECONFIG into the container's filesystem:
docker run --rm -it -v ~/.kube/config:/root/.kube/config derailed/k9sK9s includes several startup flags to customize the initial view and operational context. To list all available K9s CLI options, use:
k9s helpBy default, the application connects to the current context defined in your configuration. To start K9s using a non-default KubeConfig context, pass the --context flag:
k9s --context coolCtxSimilarly, you can restrict the initial scope to a specific namespace instead of the cluster-wide default. To run K9s in a specific namespace:
k9s -n mycoolnsOperators can also bypass the default starting view by specifying a target resource at startup. To run K9s and launch in pod view directly, run:
k9s -c podCustomizing Workflows and Extensibility
Inside the terminal UI, navigation relies on a command mode accessed by typing : followed by a resource name. To streamline this process for frequently accessed resources, users can define command shortcuts through aliases and hotkeys. Aliases map custom terms to Kubernetes resources or specific K9s views, while hotkeys bind keystrokes to particular namespaces and resource combinations, saving time during repetitive debugging tasks.
Beyond navigation, K9s supports plugins to extend functionality with custom cluster commands. This mechanism allows operators to define their own shell commands or scripts that execute against the currently highlighted resource in the UI. By combining plugins, hotkeys, and aliases, users can adapt the terminal interface to match their specific operational requirements or debugging workflows.
For comprehensive setup instructions and advanced configuration examples, refer to the K9s repository. Detailed CLI argument documentation is available in the K9s command reference, and a summary of core features can be found on the main K9s website.
Related tools
More options with a similar category or technology profile.
diskus
Minimal, fast alternative to du -sh written in Rust using multi-threaded directory traversal.
peco
Simplistic interactive filtering tool for Unix pipelines, process lists, and file trees.
Dapr CLI
Command-line tool for managing Dapr distributed application runtime environments and sidecars.
Freeze
Generate beautiful image screenshots and SVGs of code snippets and terminal outputs.