What k9s Does
- Resource Navigation: Browse all Kubernetes resources with tab completion
- Live Updates: Real-time resource updates without refreshing
- Multi-Cluster: Switch between clusters and namespaces instantly
- Logs & Shell: Stream logs and exec into pods directly
- Port Forward: One-key port forwarding
- Resource Editing: Edit YAML in your favorite editor
- RBAC View: Check permissions and roles
- Node Metrics: View CPU/memory usage per node/pod
- Benchmarking: Built-in HTTP load testing for services
- Custom Views: Save frequently used resource views
- Skins: Customizable color themes
- Plugins: Extend with custom commands and actions
Installation
Package Managers
# macOS
brew install k9s
# Linux
snap install k9s --devmode
# Or via binary
curl -sS https://webinstall.dev/k9s | bash
# Windows
choco install k9s
# Or scoop
scoop install k9s
# Docker
docker run --rm -it -v $KUBECONFIG:/root/.kube/config quay.io/derailed/k9sFrom Source
go install github.com/derailed/k9s@latestBasic Usage
Starting k9s
# Use current kubectl context
k9s
# Specify context
k9s --context my-cluster
# Start in specific namespace
k9s -n kube-system
# Read-only mode
k9s --readonly
# With custom refresh rate
k9s --refresh 2Essential Keyboard Shortcuts
Navigation
:pod — Show pods
:svc — Show services
:deploy — Show deployments
:ns — Show namespaces
:node — Show nodes
:cm — Show configmaps
:secret — Show secrets
:ing — Show ingresses
:pvc — Show persistent volume claims
:sa — Show service accounts
:cronjob — Show cronjobs
:hpa — Show horizontal pod autoscalers
:netpol — Show network policiesCommon Actions
d — Describe resource
v — View YAML
e — Edit YAML (opens $EDITOR)
l — View logs
s — Shell into pod
:q or ctrl-c — Quit / go back
? — Show help
/ — Filter resources (fuzzy search)
Esc — Clear filter
Enter — Select / drill down
Space — Toggle mark
r — Refresh view
ctrl-d — Delete resource (with confirmation)
ctrl-k — Kill podPod-Specific
l — View logs
shift+l — View previous container logs
s — Shell into container
f — Port forward
ctrl-k — Kill pod (force delete)
shift+f — Show port forwardsContext & Namespace
:ctx — Switch context
:ns — Switch namespace
:0 — View all namespacesPulses & Benchmarks
:pulse — Cluster pulse (heartbeat view)
:bench — Start HTTP benchmark
ctrl+b — Toggle benchmark on serviceAdvanced Features
Custom Aliases
Create ~/.config/k9s/aliases.yaml:
aliases:
po: pod
dep: deployment
svc: service
cmap: configmap
sec: secret
# Custom shortcut
prod: "-n production pod"Use with :prod to show pods in production namespace.
Hotkeys
Create ~/.config/k9s/hotkeys.yaml:
hotKey:
shift-0:
shortCut: Shift-0
description: Viewing all pods
command: pods
shift-1:
shortCut: Shift-1
description: Viewing services
command: servicesPlugins
Create ~/.config/k9s/plugin.yaml:
plugin:
tail-logs:
shortCut: Ctrl-L
description: "Tail logs with grep"
scopes:
- po
command: sh
background: false
args:
- -c
- "kubectl logs -f --tail=100 $NAME -n $NAMESPACE | less"
debug-container:
shortCut: Shift-D
description: "Launch debug container"
scopes:
- po
command: kubectl
background: false
args:
- debug
- -it
- "$NAME"
- --image=nicolaka/netshoot
- --target=$NAME
- -n
- "$NAMESPACE"Skins (Themes)
Create ~/.config/k9s/skins/dracula.yaml:
k9s:
body:
fgColor: "#F8F8F2"
bgColor: "#282A36"
logoColor: "#BD93F9"
# ... more color settingsSet in config: skin: dracula
Views & Contexts
k9s remembers your views per context. Each kubectl context has its own state:
- Last viewed resource
- Active filters
- Saved views
- Custom columns
Productivity Tips
Filter Resources
/nginx — Show resources matching "nginx"
/!system — Exclude "system"View Multiple Resources
:svc,pod — Show both services and podsDecoded Secrets
k9s can decode base64 secrets in real-time:
Navigate to secret → x (decode) → shows plaintextLive Logs with Highlighting
Navigate to pod → l (logs)
/ — Filter logs by keyword
t — Toggle follow mode
Shift-T — Toggle timestamps
Shift-F — Show full logk9s vs Alternatives
| Feature | k9s | Lens | kubectl | OpenLens |
|---|---|---|---|---|
| Interface | Terminal | GUI | CLI | GUI |
| Speed | Very fast | Slow (GUI) | Fast | Slow (GUI) |
| Learning curve | Medium | Low | High | Low |
| Keyboard-driven | Yes | Partial | Yes | Partial |
| Multi-cluster | Yes | Yes | Yes (contexts) | Yes |
| Resource usage | ~100MB | ~500MB+ | Negligible | ~500MB+ |
| Remote SSH | Yes | Limited | Yes | Limited |
| Best for | CLI users, SRE | GUI users | Scripting | OSS Lens |
FAQ
Q: What permissions does k9s need?
A: k9s uses your kubectl config and permissions. If kubectl can access the cluster, so can k9s. Read-only RBAC users can use --readonly mode to prevent accidental changes.
Q: Can I switch between multiple clusters?
A: Yes. Use the :ctx command to view and switch between all kubectl contexts. k9s remembers per-context state (last browsed resource, filters, etc.).
Q: How do I view CPU/memory usage?
A: Make sure metrics-server is installed in the cluster (so kubectl top works), then press :pod in k9s to view pods — live CPU and memory are shown. Press :node to see node-level resources.
Sources & Credits
- GitHub: derailed/k9s — 33.3K+ ⭐ | Apache-2.0
- Official site: k9scli.io