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

-c, --context string
    Specifies the Kubernetes context to use for connecting to the cluster.

-n, --namespace string
    Sets the default Kubernetes namespace to display when k9s starts.

-A, --all-namespaces
    Displays resources from all namespaces instead of just the default or specified one.

--config string
    Provides the path to the k9s configuration file, overriding the default location.

--log-file string
    Specifies the path where k9s should write its operational logs.

--log-level string
    Sets the logging verbosity (e.g., trace, debug, info, warn, error, fatal, panic).

--kubeconfig string
    Specifies the path to the kubeconfig file to use for Kubernetes API access.

--refresh int
    Sets the screen refresh rate in seconds (default is 2 seconds).

--screen string
    Sets the default screen or view to open on startup (e.g., pods, deployments).

DESCRIPTION

k9s is an open-source, terminal-based user interface (TUI) designed to simplify the interaction with Kubernetes clusters. It provides a curses-like interface that offers a real-time, comprehensive view of your Kubernetes resources, such as pods, deployments, services, nodes, and more. Users can navigate through various cluster components, inspect logs, exec into containers, delete resources, and perform other administrative tasks directly from the terminal without complex kubectl commands. Its intuitive keyboard-driven navigation and real-time data updates make it an invaluable tool for developers and operations teams managing Kubernetes deployments, streamlining daily cluster operations and troubleshooting.

CAVEATS

k9s is a third-party utility and not a core Linux command. It requires a correctly configured kubectl environment and access to a Kubernetes cluster. While generally efficient, it might consume notable resources on very large clusters or during extensive data retrieval. It complements, but does not entirely replace, the functionality of the kubectl command-line tool, especially for advanced scripting or automation.

INTERACTIVE NAVIGATION

k9s is primarily keyboard-driven, offering a wide array of hotkeys and shortcuts for quick navigation, filtering, sorting, and executing actions on Kubernetes resources. This allows users to efficiently drill down into cluster details without touching the mouse.

CUSTOMIZATION AND EXTENSIBILITY

Users can highly customize k9s through configuration files. This includes defining custom aliases for commands, modifying themes, and even creating custom resource views. It also supports plugins for extending its functionality beyond the built-in features.

HISTORY

k9s was developed by Fernand Galiana (derailed) and released as an open-source project. It quickly gained significant traction within the Kubernetes community due to its intuitive design, rich features, and ability to greatly simplify the daily operational tasks on Kubernetes clusters. Its continuous development and active community support have cemented its place as a popular tool for Kubernetes cluster management.

SEE ALSO

kubectl(1)

Copied to clipboard