K9s is a terminal based UI to interact with your Kubernetes clusters. K9s continually watches Kubernetes for changes and offers subsequent commands to interact with your observed resources.
Installation
Linux
macOS
Navigation Basics
Before diving into troubleshooting, it’s important to understand k9s navigation:
Essential Commands
- Help Menu:
?
- Access the help documentation - Exit K9s:
:q
orCtrl+C
- Quit the application - Resource Aliases:
Ctrl+A
- View available resource shortcuts - Filtering:
- Basic Filter:
/
followed by your search term - Inverse Filter:
/!
followed by exclusion term - Label Filter:
/-l
followed by label selector
- Basic Filter:
Working with Kubernetes Controllers
StatefulSets (sts)
- View & Filter:
- View: Use
:sts
command - Filter by name:
:sts /name
- View in specific namespace:
:sts namespace-name
- View: Use
- Common operations:
- Scale: Select StatefulSet and press
s
- Describe: Press
d
- Edit: Press
e
- Delete: Press
ctrl-d
(with confirmation)
- Scale: Select StatefulSet and press
DaemonSets (ds)
- View & Filter:
- View DaemonSets: Use
:ds
command - Filter DaemonSets:
:ds /name
- View in specific namespace:
:ds namespace-name
- View DaemonSets: Use
- Common operations:
- View pods: Select DaemonSet and press
enter
- Describe: Press
d
- Edit: Press
e
- Delete: Press
ctrl-d
(with confirmation)
- View pods: Select DaemonSet and press
ReplicaSets (rs)
- View & Filter:
- View ReplicaSets: Use
:rs
command - Filter ReplicaSets:
:rs /name
- View in specific namespace:
:rs namespace-name
- View ReplicaSets: Use
- Common operations:
- Scale: Select ReplicaSet and press
s
- Describe: Press
d
- Edit: Press
e
- Delete: Press
ctrl-d
(with confirmation)
- Scale: Select ReplicaSet and press
Troubleshooting Missing Pods
When a pod doesn’t appear in the expected k9s view:
-
Check other resource types:
- Use
:sts
,:ds
, or:rs
commands - View specific resources using singular/plural forms:
:pod
or:pods
- Filter pods by name:
:pod /name
- Filter by labels:
:pod app=name,env=dev
- Use
-
View all resources:
- Use
:all
command - Use
:screendump
or:sd
to view all saved resources
- Use
-
Verify the correct namespace:
- Switch namespaces: Use
:ns
- View pods in specific namespace:
:pod namespace-name
- Switch namespaces: Use
-
Examine pod status:
- Use
:pods
to find and check pod states - Use
d
to describe resources - Use
l
to view logs - Use
v
to view resource details - Use
e
to edit resources
- Use
If found, but not as a Deployment, the pod might be:
- Orphaned from a deleted Deployment
- Managed directly without a controller
Scaling in k9s
To manually scale (once found in Deployments view):
- Highlight the deployment
- Press
s
- Enter desired replica count
- Press Enter to confirm
Important Notes on Scaling
- Manual scaling in k9s doesn’t update Helm charts or releases
- Scaled values persist until the next deployment or manual change
- Helm deployments may override manual scaling if replica count is specified in the chart
- To preserve manual scaling across Helm upgrades, use
--reuse-values
flag (use cautiously) - For permanent changes, update replica count in Helm chart values
Advanced Operations
-
Context Management:
- Switch contexts: Use
:ctx
- Direct context switch:
:ctx context-name
- View pods in specific context:
:pod @ctx1
- Switch contexts: Use
-
Resource Management:
- Delete resource: Press
ctrl-d
(requires confirmation) - Force delete resource: Press
ctrl-k
(no confirmation) - View resource relationships: Use
:xray RESOURCE [NAMESPACE]
- Monitor resource metrics: Use
:pulses
or:pu
- Delete resource: Press