Skip to main content

K9s

K9s is a terminal UI for Kubernetes. It talks to the cluster using your current kubeconfig (same as kubectl).

Official installation guide: Install

Prerequisites
#

  • A working kubectl context (kubectl cluster-info should succeed)
  • A terminal that supports 256 colors (on Unix, TERM=xterm-256color is typical)
  • For in-app edits, set EDITOR or KUBE_EDITOR to your preferred editor
export TERM=xterm-256color
export KUBE_EDITOR="${KUBE_EDITOR:-vim}"

Installation
#

For macOS, Windows, and other install options (MacPorts, Chocolatey, Scoop, tarball layout details, building from source), follow the official installation guide.

Linux
#

Arch Linux:

pacman -S k9s

Homebrew on Linux:

brew install derailed/k9s/k9s

Other distributions: download a release tarball for your architecture from GitHub releases, extract it, and place the k9s binary on your PATH.

Run
#

k9s

K9s uses the current context from kubeconfig. There is no separate “command line” in the traditional sense: you work through colon commands (:), shortcuts, and key bindings.


1. Resource navigation (:)
#

Type : to enter command mode, then a resource alias.

Core workloads
#

CommandResource
:pods, :poPods
:deployments, :deploy, :dpDeployments
:services, :svcServices
:statefulsets, :stsStatefulSets
:daemonsets, :dsDaemonSets
:replicasets, :rsReplicaSets
:jobsJobs
:cronjobs, :cjCronJobs

Cluster and infrastructure
#

CommandResource
:nodes, :noNodes
:namespaces, :nsNamespaces
:eventsEvents
:contexts, :ctxkubeconfig contexts
:crdCustomResourceDefinitions
:metricsResource usage (requires metrics-server or equivalent)

Storage
#

CommandResource
:pvPersistentVolumes
:pvcPersistentVolumeClaims
:scStorageClasses

Config and secrets
#

CommandResource
:configmaps, :cmConfigMaps
:secrets, :secSecrets

Ingress and networking
#

CommandResource
:ingresses, :ingIngress
:networkpolicies, :netpolNetworkPolicies

2. Search and filtering
#

KeyAction
/Filter rows in the current view
nNamespace selector
:Command mode (jump to a resource view)

Example: type /nginx to narrow the list to resources whose visible text matches nginx.


3. Navigation
#

KeyAction
EnterDrill into the selected resource (for example pod → containers)
EscGo back
qLeave the current view
Ctrl+CExit K9s

4. Actions on a resource
#

Bindings can vary slightly by view; the help screen (?) is authoritative for the active context.

KeyTypical action
dDescribe
yYAML
eEdit
lLogs
sShell (exec into container)
fLog follow
Ctrl+DDelete
Shift+FPort forward

5. Context and namespace
#

CommandAction
:ctxSwitch kube context
:nsSwitch namespace

6. Metrics and sorting
#

  • Open a resource with : as usual.
  • Shift+S toggles or cycles sort modes depending on the view.
  • When metrics are available, you can often sort by CPU or memory from the table headers / sort UI for that view.

7. Global shortcuts
#

KeyAction
?Help (all bindings for the current view)
:Command mode
/Filter
Ctrl+AFirst row
Ctrl+ELast row
gTop of list (many views)
GBottom of list

8. Example debugging flow
#

  1. :ns — pick a namespace
  2. :po — list pods
  3. /crash — filter to suspicious names or statuses
  4. Enter — open the pod
  5. l — logs
  6. d — describe
  7. s — exec shell
  8. y — inspect YAML