MCPcopy
hub / github.com/derailed/k9s

github.com/derailed/k9s @v0.51.0 sqlite

repository ↗ · DeepWiki ↗ · release v0.51.0 ↗
4,649 symbols 18,604 edges 521 files 2,404 documented · 52%
README

k9s

K9s - Kubernetes CLI To Manage Your Clusters In Style!

K9s provides a terminal UI to interact with your Kubernetes clusters. The aim of this project is to make it easier to navigate, observe and manage your applications in the wild. K9s continually watches Kubernetes for changes and offers subsequent commands to interact with your observed resources.


Note...

K9s is not pimped out by a big corporation with deep pockets. It is a complex OSS project that demands a lot of my time to maintain and support. K9s will always remain OSS and therefore free! That said, if you feel k9s makes your day to day Kubernetes journey a tad brighter, saves you time and makes you more productive, please consider sponsoring us! Your donations will go a long way in keeping our servers lights on and beers in our fridge!

Thank you!


Go Report Card golangci badge Docker Pulls release License Releases


Screenshots

  1. Pods
  2. Logs
  3. Deployments

Demo Videos/Recordings


Documentation

Please refer to our K9s documentation site for installation, usage, customization and tips.


Slack Channel

Wanna discuss K9s features with your fellow K9sers or simply show your support for this tool?


Installation

K9s is available on Linux, macOS and Windows platforms. Binaries for Linux, Windows and Mac are available as tarballs in the release page.

shell brew install derailed/k9s/k9s

shell sudo port install k9s

  • Via snap for Linux

shell snap install k9s --devmode

  • On Arch Linux

shell pacman -S k9s

  • On OpenSUSE Linux distribution

shell zypper install k9s

  • On FreeBSD

shell pkg install k9s

  • On Ubuntu

shell wget https://github.com/derailed/k9s/releases/latest/download/k9s_linux_amd64.deb && sudo apt install ./k9s_linux_amd64.deb && rm k9s_linux_amd64.deb

  • On Fedora (42+)

shell dnf install k9s

shell winget install k9s

shell scoop install k9s

shell choco install k9s

  • Via a GO install

shell # NOTE: The dev version will be in effect! go install github.com/derailed/k9s@latest

  • Via Webi for Linux and macOS

shell curl -sS https://webinstall.dev/k9s | bash

  • Via pkgx for Linux and macOS

shell pkgx k9s

  • Via gah for Linux and macOS

shell gah install k9s

  • Via Webi for Windows

shell curl.exe -A MS https://webinstall.dev/k9s | powershell

shell docker extension install spurin/k9s-dd-extension:latest


Building From Source

K9s is currently using GO v1.23.X or above. In order to build K9s from source you must:

  1. Clone the repo
  2. Build and run the executable

    shell make build && ./execs/k9s


Running with Docker

Running the official Docker image

You can run k9s as a Docker container by mounting your KUBECONFIG:

shell docker run --rm -it -v $KUBECONFIG:/root/.kube/config derailed/k9s

For default path it would be:

shell docker run --rm -it -v ~/.kube/config:/root/.kube/config derailed/k9s

Building your own Docker image

You can build your own Docker image of k9s from the Dockerfile with the following:

shell docker build -t k9s-docker:v0.0.1 .

You can get the latest stable kubectl version and pass it to the docker build command with the --build-arg option. You can use the --build-arg option to pass any valid kubectl version (like v1.18.0 or v1.19.1).

shell KUBECTL_VERSION=$(make kubectl-stable-version 2>/dev/null) docker build --build-arg KUBECTL_VERSION=${KUBECTL_VERSION} -t k9s-docker:0.1 .

Run your container:

shell docker run --rm -it -v ~/.kube/config:/root/.kube/config k9s-docker:0.1


PreFlight Checks

  • K9s uses 256 colors terminal mode. On `Nix system make sure TERM is set accordingly.

    shell export TERM=xterm-256color

  • In order to issue resource edit commands make sure your EDITOR and KUBE_EDITOR env vars are set.

    ```shell

    Kubectl edit command will use this env var.

    export KUBE_EDITOR=my_fav_editor ```

  • K9s prefers recent kubernetes versions ie 1.28+


K8S Compatibility Matrix

k9s k8s client
>= v0.27.0 1.26.1
v0.26.7 - v0.26.6 1.25.3
v0.26.5 - v0.26.4 1.25.1
v0.26.3 - v0.26.1 1.24.3
v0.26.0 - v0.25.19 1.24.2
v0.25.18 - v0.25.3 1.22.3
v0.25.2 - v0.25.0 1.22.0
<= v0.24 1.21.3

The Command Line

# List current version
k9s version

# To get info about K9s runtime (logs, configs, etc..)
k9s info

# List all available CLI options
k9s help

# To run K9s in a given namespace
k9s -n mycoolns

# Start K9s in an existing KubeConfig context
k9s --context coolCtx

# Start K9s in readonly mode - with all cluster modification commands disabled
k9s --readonly

Logs And Debug Logs

Given the nature of the ui k9s does produce logs to a specific location. To view the logs and turn on debug mode, use the following commands:

# Find out where the logs are stored
k9s info
 ____  __.________
|    |/ _/   __   \______
|      < \____    /  ___/
|    |  \   /    /\___ \
|____|__ \ /____//____  >
        \/            \/

Version:           vX.Y.Z
Config:            /Users/fernand/.config/k9s/config.yaml
Logs:              /Users/fernand/.local/state/k9s/k9s.log
Dumps dir:         /Users/fernand/.local/state/k9s/screen-dumps
Benchmarks dir:    /Users/fernand/.local/state/k9s/benchmarks
Skins dir:         /Users/fernand/.local/share/k9s/skins
Contexts dir:      /Users/fernand/.local/share/k9s/clusters
Custom views file: /Users/fernand/.local/share/k9s/views.yaml
Plugins file:      /Users/fernand/.local/share/k9s/plugins.yaml
Hotkeys file:      /Users/fernand/.local/share/k9s/hotkeys.yaml
Alias file:        /Users/fernand/.local/share/k9s/aliases.yaml

View K9s logs

tail -f /Users/fernand/.local/data/k9s/k9s.log

Start K9s in debug mode

k9s -l debug

Customize logs destination

You can override the default log file destination either with the --logFile argument:

k9s --logFile /tmp/k9s.log
less /tmp/k9s.log

Or through the K9S_LOGS_DIR environment variable:

K9S_LOGS_DIR=/var/log k9s
less /var/log/k9s.log

Key Bindings

K9s uses aliases to navigate most K8s resources.

Action Command Comment
Show active keyboard mnemonics and help ?
Show all available resource alias ctrl-a
To bail out of K9s :quit, :q, ctrl-c
To go up/back to the previous view esc If you have crumbs on, this will go to the previous one
View a Kubernetes resource using singular/plural or short-name :pod⏎ accepts singular, plural, short-name or alias ie pod or pods
View a Kubernetes resource in a given namespace :pod ns-x⏎
View filtered pods (New v0.30.0!) :pod /fred⏎ View all pods filtered by fred
View labeled pods (New v0.30.0!) :pod app=fred,env=dev⏎ View all pods with labels matching app=fred and env=dev
View pods in a given context (New v0.30.0!) :pod @ctx1⏎ View all pods in context ctx1. Switches out your current k9s context!
Filter out a resource view given a filter /filter⏎ Regex2 supported ie fred|blee to filter resources named fred or blee
Inverse regex filter /! filter⏎ Keep everything that doesn't match.
Filter resource view by labels /-l label-selector⏎
Fuzzy find a resource given a filter /-f filter⏎
Bails out of view/command/filter mode <esc>
To view and switch to another Kubernetes context (Pod view) :ctx⏎
To view and switch directly to another Kubernetes context (Last used view) :ctx context-name⏎
To view and switch to another Kubernetes namespace :ns⏎
To switch back to the last active command (like how "cd -" works) - Navigation that adds breadcrumbs to the bottom are not commands
To go back and forward through the command history back: [, forward: ] Same as above
To view all saved resources :screendump or sd⏎
To delete a resource (TAB and ENTER to confirm) ctrl-d
To kill a resource (no confirmation dialog, equivalent to kubectl delete --now) ctrl-k
Launch pulses view :pulses or pu⏎
Launch XRay view

Extension points exported contracts — how you extend this code

Filterable (Interface)
Filterable represents an entity that can be filtered. [6 implementers]
internal/model/text.go
Hinter (Interface)
Hinter represents a view that can produce menu hints. [11 implementers]
internal/view/types.go
Factory (Interface)
Factory represents a resource factory. [7 implementers]
internal/dao/types.go
StyleListener (Interface)
StyleListener represents a skin's listener. [17 implementers]
internal/config/styles.go
Namespaceable (Interface)
Namespaceable tracks namespaces. [5 implementers]
internal/ui/types.go
Authorizer (Interface)
Authorizer checks what a user can or cannot do to a resource. [3 implementers]
internal/client/types.go
ContextNamer (Interface)
ContextNamer represents a named context. [3 implementers]
internal/render/context.go
Renderer (Interface)
Renderer represents a resource renderer. [3 implementers]
internal/model1/types.go

Core symbols most depended-on inside this repo

App
called by 370
internal/view/types.go
Run
called by 318
internal/dao/types.go
Flash
called by 259
internal/ui/config.go
GetTable
called by 196
internal/view/types.go
Error
called by 189
internal/client/errors.go
Color
called by 174
internal/config/color.go
NewGVR
called by 158
internal/client/gvr.go
NewKeyAction
called by 154
internal/ui/action.go

Shape

Method 2,694
Function 1,384
Struct 371
TypeAlias 86
Interface 77
FuncType 37

Languages

Go100%

Modules by API surface

internal/config/styles.go90 symbols
internal/ui/table.go59 symbols
internal/view/xray.go57 symbols
internal/view/pulse.go51 symbols
internal/dao/types.go51 symbols
internal/view/app.go49 symbols
internal/xray/tree_node.go48 symbols
internal/view/log.go48 symbols
internal/model/types.go45 symbols
internal/client/client.go45 symbols
internal/view/browser.go44 symbols
internal/model/log.go44 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

cel.dev/exprv0.25.1 · 1×
cloud.google.com/gov0.123.0 · 1×
cloud.google.com/go/authv0.18.2 · 1×
cloud.google.com/go/auth/oauth2adaptv0.2.8 · 1×
cloud.google.com/go/compute/metadatav0.9.0 · 1×
cloud.google.com/go/monitoringv1.24.3 · 1×
cloud.google.com/go/storagev1.61.3 · 1×
cyphar.com/go-pathrsv0.2.1 · 1×
dario.cat/mergov1.0.2 · 1×
github.com/Azure/go-ansitermv0.0.0-2025010203350 · 1×
github.com/BurntSushi/tomlv1.6.0 · 1×

For agents

$ claude mcp add k9s \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact