LinuxCommandLibrary

k9s

Manage and observe Kubernetes clusters

TLDR

Manage a cluster using a kubeconfig context

$ k9s --context [kubeconfig_context_name]
copy

Manage a cluster in read-only mode (disabling all commands that may cause modifications)
$ k9s --readonly --cluster [cluster_name]
copy

Manage a cluster using a given Kubernetes namespace
$ k9s [[-n|--namespace]] [kubernetes_namespace] --cluster [cluster_name]
copy

Manage a cluster launching k9s in the pod view and enable debug logging
$ k9s [[-c|--command]] [pod] [[-l|--logLevel]] debug --cluster [cluster_name]
copy

SYNOPSIS

k9s [OPTIONS]

PARAMETERS

--cache-dir DIR
    K9s cache directory (default: ~/.cache/k9s)

--cmd COMMAND
    Default exec command (default: sh)

--config FILE
    Path to K9s config file (default: ~/.config/k9s/config.yml)

--context NAME
    Kubeconfig context to use

--crds
    Enable CRDs discovery (default: true)

--csv
    Output in CSV format

--headless
    Run in headless mode without UI

--help, -h
    Show help

--insecure
    Allow insecure API server connections

--kubeconfig FILE
    Path to kubeconfig (default: ~/.kube/config)

--log-level LEVEL
    Log level: debug|info|warn|error (default: info)

--namespace, -n NS
    Default namespace

--request-timeout DURATION
    Timeout for server requests (default: 1m)

--use-vt100
    Use VT100 terminal emulation

--version, -V
    Print version information

DESCRIPTION

K9s is a lightweight, terminal-based user interface for managing Kubernetes clusters. It leverages kubectl under the hood to provide an intuitive curses interface for navigating namespaces, pods, deployments, services, and other resources.

Key features include real-time pod monitoring, log viewing with tailing, port-forwarding, shell access via exec, image inspection, and customizable views for custom resources (CRDs). Users can filter, sort, and search resources efficiently using hotkeys.

Designed for developers and operators, K9s simplifies cluster operations without leaving the terminal. It supports multi-cluster setups via kubeconfig contexts and offers plugins for extended functionality. Configuration is YAML-based, allowing theme customization, keybindings, and thresholds for alerts.

Built in Go, it's cross-platform, fast, and resource-efficient, making it ideal for local development, CI/CD pipelines, or remote SSH sessions.

CAVEATS

Requires valid kubeconfig and kubectl access. Not suitable for high-volume production monitoring; UI refreshes may lag under heavy load.
Terminal must support 256 colors for best experience.

INSTALLATION

Via Homebrew: brew install k9s
Snap: snap install k9s
Binaries: GitHub releases.

KEYBINDINGS

:pods → pod list
:log → view logs
:portfwd → port-forward
/? → help menu
Esc → back.

VIEWS

Core screens: Pods, Deployments, Services, Nodes, Events. Hotkey : + resource name to switch.

HISTORY

Created in 2018 by Oleg Fiło (derailedpoesh). Open-source on GitHub (k9scli/k9s) with 25k+ stars. Actively maintained, latest v0.32+ adds hot reload and better CRD support.

SEE ALSO

kubectl(1), kubens(1), kubectx(1), helm(1)

Copied to clipboard