Stop memorizing endless
kubectlcommands. K9s gives you a real-time, interactive terminal dashboard for managing every resource in your cluster — with keyboard shortcuts for everything.
Table of Contents
- Why kubectl Alone Isn't Enough
- What is K9s?
- Installation
- Core Features
- Complete Shortcut Reference
- All Resource Commands at a Glance
- 5 Workflows That Will Save You Hours
- Pro Tips & Power User Tricks
- Conclusion
Why kubectl Alone Isn't Enough
Anyone who has spent serious time with Kubernetes knows the pain: debugging a crashing pod means running four or five different commands just to understand what's happening. You're constantly context-switching between terminal windows, squinting at JSON blobs, and copy-pasting pod names.
# The old way — just to debug ONE crashing pod
kubectl get pods -n production
kubectl describe pod api-gateway-7d9f8b-xkp2q -n production
kubectl logs api-gateway-7d9f8b-xkp2q -n production --previous
kubectl exec -it api-gateway-7d9f8b-xkp2q -n production -- /bin/sh
kubectl port-forward api-gateway-7d9f8b-xkp2q 8080:80 -n production
That's five commands, three copy-pastes, and a lot of cognitive overhead — just for one pod.
kubectl vs K9s Side by Side
| Task | ⚡ K9s | kubectl |
|---|---|---|
| View all pods |
:pod then Enter |
kubectl get pods -A |
| Stream pod logs | Select + l
|
kubectl logs -f <pod-name> |
| Exec into pod shell | Select + s
|
kubectl exec -it <pod> -- /bin/sh |
| Port-forward | Select + Shift+F
|
kubectl port-forward <pod> 8080:80 |
| Delete a resource | Select + Ctrl+D
|
kubectl delete pod <name> |
| Edit resource YAML | Select + e
|
kubectl edit pod <name> |
| Switch namespace |
Ctrl+A for all namespaces |
-n flag on every command |
| Real-time CPU/Mem | ✅ Built-in pulse view | ❌ Requires separate tooling |
| Rolling restart | Select + Ctrl+L
|
kubectl rollout restart deploy/<name> |
| Decode secrets | Select + x
|
kubectl get secret <name> -o jsonpath=... |
What is K9s?
K9s is an open-source, terminal-based UI built by Fernand Galiana that wraps the entire Kubernetes API in a fast, keyboard-driven interface.
It's not a GUI — it lives in your terminal, it's blazing fast, and once you learn the shortcuts, you'll never want to go back to plain kubectl.
💡 Think of K9s as
htopfor Kubernetes — it continuously watches your cluster state and updates in real time.
____ __.________
| |/ _/ __ \______
| < \____ / ___/
| | \ / /\___ \
|____|__ \ /____//____ >
\/ \/
K9s — Kubernetes CLI To Manage Your Clusters In Style!
Key facts:
- ⭐ 30,000+ GitHub stars
- 🐕 Named after the "canine" unit — it "watches" your cluster
- 🔄 Real-time polling — no manual refresh needed
- 🔐 Fully RBAC-aware — respects your cluster permissions
- 🧩 Supports every Kubernetes resource including CRDs
Installation
K9s runs on Linux, macOS, and Windows. Pick your method:
macOS — Homebrew
brew install derailed/k9s/k9s
Linux
# Via webinstall
curl -sS https://webinstall.dev/k9s | bash
# Via Snap
sudo snap install k9s
# Via apt (Ubuntu/Debian)
sudo apt install k9s
# Via binary — download from GitHub releases
wget https://github.com/derailed/k9s/releases/latest/download/k9s_Linux_amd64.tar.gz
tar -xzf k9s_Linux_amd64.tar.gz
sudo mv k9s /usr/local/bin/
Windows
# Chocolatey
choco install k9s
# Scoop
scoop install k9s
Docker
docker run --rm -it \
-v ~/.kube/config:/root/.kube/config \
quay.io/derailed/k9s
Verify Installation
k9s version
k9s # Launch!
K9s auto-detects your ~/.kube/config on launch.
Launch Flags
| Command | Description |
|---|---|
k9s |
Launch with current kubeconfig context |
k9s -n kube-system |
Launch in a specific namespace |
k9s --context prod |
Launch in a specific kube context |
k9s --readonly |
Launch in read-only mode (safe for production) |
k9s --kubeconfig /path |
Use a custom kubeconfig file |
k9s --all-namespaces |
Start with all namespaces visible |
⚠️ Production Safety Tip: Always use
k9s --readonlywhen connecting to production clusters. This disables all mutating operations and prevents accidental deletes or edits.
Core Features
🔴 Real-Time Cluster State
K9s continuously polls your cluster and refreshes the view automatically. Watch pods crash and recover without hitting a single key.
⌨️ Fully Keyboard Driven
Every action — logs, exec, describe, delete, port-forward — is one or two keystrokes away. Zero mouse needed.
📋 Universal Resource Access
Type :pod, :svc, :deploy, :node or any CRD name. K9s handles every Kubernetes resource type including custom ones.
📊 CPU & Memory Metrics
Built-in pulse view shows live resource usage per pod and node. Color-coded thresholds alert you before things go down.
🔍 Fuzzy Search & Filter
Press / to filter any resource list instantly. Supports regex patterns for precise searching across thousands of resources.
🎨 Skins & Plugins
Customize colors, create your own keyboard shortcuts, and extend K9s with community or custom plugins.
🔐 RBAC-Aware
K9s respects your cluster's RBAC configuration. Users only see what they're permitted to see — no special access needed.
📦 Multi-Context / Multi-Cluster
Switch between clusters and contexts instantly without restarting. Perfect for managing dev, staging, and production clusters.
🔖 Built-in Benchmarking
Load test a service endpoint directly from the K9s interface using Ctrl+B on any service. No external tool needed.
🔭 X-Ray View
Renders the full dependency tree of any resource — deployments → replicasets → pods → containers — all in one view.
🧹 Popeye Integration
Type :popeye to run a live cluster sanitizer that scans for misconfigurations, deprecated APIs, and security risks.
Complete Shortcut Reference
💡 Vim users: K9s supports
j/kfor navigation,g/Gfor top/bottom, and/to search. You're already home.
Global Navigation
These shortcuts work from any view in K9s.
| Shortcut | Action |
|---|---|
: + resource name |
Go to any resource view (e.g., :pod, :svc, :node) |
? |
Open help / shortcut cheat sheet |
Ctrl+A |
Toggle all namespaces view |
Ctrl+C |
Quit K9s |
Esc |
Go back / exit current view / cancel filter |
/ |
Enter filter mode (fuzzy search current list) |
! |
Toggle error view |
Ctrl+U |
Clear filter |
↑ / ↓ or k / j
|
Navigate up/down (vim-style works!) |
g / G
|
Jump to top / bottom of list |
Ctrl+R |
Refresh / reload the current view |
:ctx |
Switch Kubernetes context |
:ns |
Switch namespace |
:h |
View command history |
Ctrl+E |
Hide / show the header bar |
Ctrl+P |
Toggle CPU/Mem pulse panel on/off |
z |
Toggle error panel |
Pod Management
Enter
:podor:poto access this view.
| Shortcut | Action |
|---|---|
l |
Stream logs for the selected pod |
p |
Previous logs (like --previous flag — for crashed containers) |
s |
Open a shell (exec) into the selected pod/container |
d |
Describe the selected pod (full metadata + events) |
e |
Edit the pod YAML in your $EDITOR
|
y |
View full YAML of the selected resource |
Ctrl+K |
Force kill / delete the selected pod (no confirmation) |
Ctrl+D |
Delete with grace period (safe delete, with confirmation) |
Shift+F |
Open port-forward menu for the pod |
f |
Show all active port-forwards |
Ctrl+W |
Toggle wide output (shows more columns) |
Shift+C |
Sort by CPU usage |
Shift+M |
Sort by memory usage |
Shift+N |
Sort by pod name |
Shift+O |
Sort by container count |
Shift+R |
Sort by restart count |
Shift+T |
Sort by age (time) |
Ctrl+L |
Rolling restart of the pods in the parent deployment |
a |
View containers within the pod |
Enter |
Drill into pod / select container |
Log Viewer
Press
lon any pod to enter the log viewer.
| Shortcut | Action |
|---|---|
f |
Toggle full screen for log view |
w |
Toggle line wrap |
↑ / ↓
|
Scroll up/down through logs |
Page Up / Page Down
|
Scroll by full page |
g |
Jump to top (oldest logs) |
G |
Jump to bottom (newest / live logs) |
/ |
Search / filter within logs |
s |
Toggle auto-scroll (tail mode on/off) |
t |
Toggle timestamps in log output |
p |
View previous container logs (for restarted containers) |
Ctrl+S |
Save logs to a local file |
0–9
|
Switch between containers within the pod |
c |
Copy log line to clipboard |
Services & Networking
| Command / Shortcut | Action |
|---|---|
:svc |
View all Services |
:ing |
View all Ingresses |
:ep |
View Endpoints |
:netpol |
View NetworkPolicies |
:pf |
Manage all active port-forwards |
Shift+F on a Service |
Open port-forward dialog for the service |
d on a Service |
Describe service (selectors, ports, endpoints) |
y on a Service |
View full Service YAML |
e on a Service |
Edit service configuration |
Ctrl+B on a Service |
Benchmark the service endpoint (load test) |
Enter on an Ingress |
View ingress rules and backend info |
Deployments, ReplicaSets & StatefulSets
| Command / Shortcut | Action |
|---|---|
:deploy or :dp
|
View all Deployments |
:rs |
View all ReplicaSets |
:sts |
View all StatefulSets |
:ds |
View all DaemonSets |
Ctrl+L on a Deployment |
Trigger a rolling restart |
s on a Deployment |
Scale — open scale dialog (set replica count) |
d |
Describe the deployment (events, conditions, strategy) |
Enter on a Deployment |
Drill down into pods belonging to deployment |
y |
View full deployment YAML |
e |
Edit deployment YAML inline |
Ctrl+D |
Delete the deployment (with confirmation) |
Nodes & Cluster Management
| Command / Shortcut | Action |
|---|---|
:node or :no
|
View all cluster nodes |
Shift+C |
Sort nodes by CPU usage |
Shift+M |
Sort nodes by memory usage |
d on a Node |
Describe node (taints, conditions, capacity, allocatable) |
Enter on a Node |
View all pods running on that node |
y on a Node |
View full node YAML (labels, annotations) |
Ctrl+U on a Node |
Cordon a node (prevent new pod scheduling) |
Ctrl+N on a Node |
Uncordon a node (re-enable scheduling) |
Ctrl+D on a Node |
Drain the node (evict all pods safely) |
:cl |
Cluster info view (API server, version info) |
:ev |
View all cluster events (warnings, errors) |
ConfigMaps, Secrets & Storage
| Command / Shortcut | Action |
|---|---|
:cm |
View all ConfigMaps |
:secret |
View all Secrets |
x on a Secret |
Decode and view base64 secret values |
e on a Secret |
Edit a secret (values auto-encoded on save) |
:pvc |
View PersistentVolumeClaims |
:pv |
View PersistentVolumes |
:sc |
View StorageClasses |
d |
Describe selected resource |
Ctrl+D |
Delete selected resource |
RBAC & Access Control
| Command | Action |
|---|---|
:sa |
View ServiceAccounts |
:rb |
View RoleBindings |
:crb |
View ClusterRoleBindings |
:cr |
View ClusterRoles |
:role |
View Roles (namespaced) |
:hpa |
View HorizontalPodAutoscalers |
:vpa |
View VerticalPodAutoscalers |
:po (PodDisruptionBudgets context) |
View PodDisruptionBudgets |
Jobs & CronJobs
| Command / Shortcut | Action |
|---|---|
:job |
View all Jobs |
:cj |
View all CronJobs |
Ctrl+T on a CronJob |
Trigger a CronJob manually (creates job immediately) |
Enter on a Job |
View pods spawned by this job |
d |
Describe the job (completions, conditions, duration) |
Ctrl+D |
Delete job |
Custom Resources (CRDs)
| Command / Shortcut | Action |
|---|---|
:crd |
View all Custom Resource Definitions |
:<crd-short-name> |
Navigate directly to any CRD (e.g., :vs for VirtualService) |
Enter on a CRD |
List all instances of that custom resource |
d |
Describe a CRD instance |
y |
View the YAML of a CRD instance |
e |
Edit a CRD instance |
All Resource Commands at a Glance
Type these with : from anywhere in K9s to jump to any resource view instantly.
Workloads
| Command | Resource |
|---|---|
:pod / :po
|
Pods |
:deploy / :dp
|
Deployments |
:sts |
StatefulSets |
:ds |
DaemonSets |
:rs |
ReplicaSets |
:job |
Jobs |
:cj |
CronJobs |
Networking
| Command | Resource |
|---|---|
:svc |
Services |
:ing |
Ingresses |
:ep |
Endpoints |
:netpol |
NetworkPolicies |
:pf |
Active Port Forwards |
Cluster
| Command | Resource |
|---|---|
:node / :no
|
Nodes |
:ns |
Namespaces |
:ctx |
Contexts (switch cluster) |
:ev |
Events |
:cl |
Cluster Info |
Config & Storage
| Command | Resource |
|---|---|
:cm |
ConfigMaps |
:secret |
Secrets |
:sa |
ServiceAccounts |
:pvc |
PersistentVolumeClaims |
:pv |
PersistentVolumes |
:sc |
StorageClasses |
RBAC
| Command | Resource |
|---|---|
:rb |
RoleBindings |
:crb |
ClusterRoleBindings |
:cr |
ClusterRoles |
:role |
Roles |
Auto-scaling
| Command | Resource |
|---|---|
:hpa |
HorizontalPodAutoscalers |
:vpa |
VerticalPodAutoscalers |
Advanced Views
| Command | Description |
|---|---|
:crd |
All Custom Resource Definitions |
:xray deploy default |
Full dependency tree for deployments in default ns |
:pulses |
Live cluster-wide CPU/MEM metrics dashboard |
:popeye |
Run cluster sanitizer (finds misconfigs, deprecated APIs) |
5 Workflows That Will Save You Hours
🔥 1. Debug a CrashLoopBackOff Pod
1. :pod → open pod view
2. /api-gateway → filter by name
3. l → stream current logs
4. p → view previous container logs (before crash)
5. d → describe pod, check Events section
6. s → shell in if the pod is running
All without leaving K9s, all without remembering a single pod name.
📈 2. Investigate a Memory Spike
1. Ctrl+P → open the pulse metrics panel
2. :pod → go to pod view
3. Shift+M → sort by memory usage (highest first)
4. Select offender → Enter → select container
5. s → shell in and run `top` or `ps aux`
🔁 3. Rolling Restart a Deployment
1. :deploy → open deployments view
2. Navigate to deployment
3. Ctrl+L → triggers rolling restart instantly
4. Enter → drill into pods and watch new ones come up live
No more copy-pasting: kubectl rollout restart deployment/my-app -n production
🌍 4. Test a Service Locally with Port-Forward
1. :svc → open services view
2. Select service
3. Shift+F → port-forward dialog opens
4. Enter local port (e.g., 8080)
5. Access at localhost:8080 in your browser
6. :pf → manage or stop active port-forwards anytime
⚠️ 5. Drain a Node for Maintenance
1. :node → open nodes view
2. Select the node to maintain
3. Ctrl+U → cordon it (no new pods scheduled)
4. Watch pods reschedule to other nodes in real time
5. Ctrl+D → drain the node (evict remaining pods)
6. Do your maintenance work
7. Ctrl+N → uncordon to bring it back
Pro Tips & Power User Tricks
🎨 Custom Skins / Themes
K9s supports fully custom color themes. Place a skin YAML in ~/.config/k9s/skins/.
Popular community themes:
- Dracula — dark purple theme
- Tokyo Night — muted dark blues
- Catppuccin — soft pastel palette
- Monokai — classic terminal colors
All available in the K9s skins repo.
🔌 Custom Plugins
Create ~/.config/k9s/plugins.yaml to add custom commands to any resource view.
Example — tail logs with stern:
plugin:
stern:
shortCut: Shift-S
description: "Stern multi-pod tail"
scopes:
- pods
command: stern
background: false
args:
- $NAME
- -n
- $NAMESPACE
Example — open resource in VS Code:
plugin:
vscode:
shortCut: Shift-V
description: "Open YAML in VSCode"
scopes:
- all
command: bash
background: false
args:
- -c
- "kubectl get $RESOURCE_NAME $NAME -n $NAMESPACE -o yaml | code -"
🔭 X-Ray View — Dependency Trees
One of K9s's most powerful hidden features:
:xray deploy default
This renders the full dependency tree of all deployments in the default namespace:
Deployment/api-gateway
└── ReplicaSet/api-gateway-7d9f8b
├── Pod/api-gateway-7d9f8b-xkp2q
│ ├── Container/api-gateway (Running)
│ └── Container/sidecar (Running)
└── Pod/api-gateway-7d9f8b-r9pmk
└── Container/api-gateway (Running)
Perfect for understanding resource relationships and ownership chains.
🧹 Popeye — Cluster Sanitizer
:popeye
Popeye scans your cluster for:
- 🔴 Misconfigured resources
- 🟡 Over-provisioned CPU/memory requests
- 🟠 Deprecated API versions in use
- 🔵 Missing resource limits
- 🔐 Security risks (privileged containers, host mounts)
It gives each resource a grade (A–F) so you know exactly what to fix.
⚙️ K9s Configuration File
K9s config lives at ~/.config/k9s/config.yaml:
k9s:
refreshRate: 2 # seconds between refreshes
maxConnRetry: 5
readOnly: false # set true to make read-only globally
noExitOnCtrlC: false
ui:
enableMouse: false
headless: false
logoless: false
crumbsless: false
reactive: false
noIcons: false
skipLatestRevCheck: false
disablePodCounting: false
shellPod:
image: busybox
namespace: default
limits:
cpu: 100m
memory: 100Mi
🔑 Aliases — Short Names for Resources
Add custom aliases in ~/.config/k9s/aliases.yaml:
aliases:
dp: deployments
ing: ingresses
sts: statefulsets
pp: v1/pods
crds: apiextensions.k8s.io/v1/customresourcedefinitions
Conclusion
K9s isn't just a nice-to-have — it's the kind of tool that makes you genuinely faster at your job. Whether you're debugging a production incident at 2am or iterating on a local cluster, K9s cuts through the ceremony and gets you to the information you need instantly.
Why K9s belongs in every engineer's toolkit:
- ⚡ Speed — keyboard shortcuts beat kubectl commands every time
- 👁️ Visibility — real-time view of your entire cluster in one screen
- 🔍 Debugging — logs, shell, describe, events — all in two keystrokes
- 🛡️ Safety —
--readonlymode for production, RBAC-aware by default - 🧩 Extensible — plugins, skins, aliases, custom shortcuts
- 🆓 Free & Open Source — Apache 2.0 license, actively maintained
Install it today. The first time you press l to tail logs and then s to shell in — without typing a single pod name — you'll understand why 30,000+ engineers consider K9s essential.
brew install derailed/k9s/k9s && k9s
🔗 Resources
- 🌐 K9s Official Website
- ⭐ K9s GitHub Repository
- 🎨 Community Skins
- 🔌 Community Plugins
- 📖 K9s Documentation
If this helped you, drop a ❤️ and share it with your team. Found a shortcut I missed? Drop it in the comments below! 👇
Happy clustering! 🐕
Top comments (0)