k9s cheat sheet
A quick reference guide for working with the k9s terminal application—a powerful tool for managing Kubernetes clusters from the command line.Launching k9s
Basic navigation
- Move between resources: Use the arrow keys or
j(down) andk(up). - Select resource: Press
Enterto view details or sub-resources. - Go back: Press
Escto return to the previous screen. - Quit k9s: Press
Ctrl+Corq.
Resource views
Switch resource view by pressing: and typing the resource abbreviation or name.
Common resource shortcuts:
| Command | Resource |
|---|---|
:po | Pods |
:dp | Deployments |
:svc | Services |
:cm | ConfigMaps |
:ing | Ingresses |
:ns | Namespaces |
:pv | PersistentVolumes |
:secret | Secrets |
- List all resource shortcuts: Press
Tabafter:to see all options.
Filtering and searching
- Filter resources: Press
/and type your filter query. Supports regex and fuzzy searching. - Clear filter: Press
EscorCtrl+u. - Search across resources: Press
Ctrl+fand enter your search term.
Viewing resource details
- Describe resource: Press
d. - View logs: Press
l(works with Pods).- Follow logs: Press
Shift+fwithin the logs view.
- Follow logs: Press
- View YAML manifest: Press
y. - View metrics: Press
0(zero) in the Pods view.
Resource actions
- Edit resource: Press
e(opens in your default editor). - Delete resource: Press
Ctrl+d. - Scale deployment: Use
+or-to increase or decrease replicas. - Execute command in pod: Press
x(e.g., open a shell). - Port forwarding: Press
Shift+fand set up port forwarding.
Namespace and context management
- Switch namespace: Press
nand select from the list. - View all namespaces: Toggle with
Shift+a. - Switch contexts: Press
:ctxand select the desired context.
Key bindings summary
Navigation
| Key | Action |
|---|---|
j / k | Move down / up |
h / l | Move left / right or collapse / expand |
g | Go to top |
G | Go to bottom |
Ctrl+f / Ctrl+b | Page down / up |
Resource interaction
| Key | Action |
|---|---|
/ | Filter resources |
d | Describe selected resource |
l | View logs |
e | Edit resource |
y | View YAML |
s | Save YAML to a file |
Ctrl+d | Delete resource |
x | Execute command in Pod |
Shift+f | Port forwarding |
+ / - | Scale deployment up / down |
General commands
| Key | Action |
|---|---|
: | Command mode (enter resource shortcuts) |
Esc | Back or clear filter |
Ctrl+r | Refresh view |
? | Help menu |
Ctrl+a | Select all |
q / Ctrl+C | Quit k9s |
Tips and tricks
- Customize k9s: Edit
~/.k9s/config.ymlto customize themes and settings. - Copy to clipboard: Press
cin supported views. - Toggle wide view: Press
wto toggle wide columns. - View previous commands: Press
Ctrl+pto see command history. - Bookmark resources: Press
Shift+bto bookmark, andbto view bookmarks.