k9s cheat sheet
k9s is an open-source terminal-based UI tool which can be used to manage Kubernetes clusters. This tool offers a user-friendly terminal UI for managing, monitoring, and troubleshooting Kubernetes resources. This tool also offers features like real-time updates, filtering, and keyboard shortcuts.
Here's an example of it
Commands
Command | Description | Example |
---|---|---|
:ctx | Switch between Kubernetes contexts. | Type :ctx and select from the list. |
:ns | Change the current namespace or view resources in different namespaces. | Type :ns and select a namespace. |
:alias | View all available resource shortcuts like :po for pods. | Type :alias to display a list of shortcuts. |
: | Jump directly to a specific Kubernetes resource. | Type :po to quickly access the Pods view. |
Ctrl-A | Add or create a new resource from a YAML configuration file. | Press Ctrl-A , paste the YAML content. |
d | Describe the currently selected resource, providing metadata, spec, and status. | Navigate to a pod and press d for details. |
e | Edit the currently selected resource directly in the default editor. | Select a deployment and press e to edit YAML. |
x | Examine a resource in detail. | With a node selected, press x for details. |
Ctrl-K | Delete the selected resource, with a confirmation prompt. | Highlight a service and press Ctrl-K to delete. |
l | View real-time logs for a selected pod or container. | Select a pod and press l to view its logs. |
s | Open an interactive shell session within a selected pod. | Select a pod and press s to start a shell. |
/ | Initiate a search within the current resource view. | Press / and type part of a resource name. |
Ctrl-F | Apply a filter to list resources that match specific criteria. | Press Ctrl-F and type status=Running . |
0-9 | Quick access keys to switch between preset views and custom resource definitions. | Press 1 to access the first custom view. |
h or ? | Display the help menu with all commands and shortcuts. | Press h to open the help menu. |
Shift-R | Refresh the current view to update with the latest cluster state. | Press Shift-R if the display seems outdated. |
Ctrl-C | Exit K9s. | Press Ctrl-C anytime to quit the application. |
k9s -c | Start K9s and navigate directly to a specific resource type. | Execute k9s -c deploy to open deployments view. |
k9s info | Display information about the K9s installation and the Kubernetes configuration. | Execute k9s info for detailed info. |
k9s edit config | Edit the K9s configuration file directly. | Run k9s edit config to adjust settings. |
Advanced Features
Feature | Description | Example |
---|---|---|
Snapshots | Capture snapshots of the current resource view. | Use to save a current state for later troubleshooting. |
Benchmarks | Perform network and performance benchmarks on services within your cluster. | Analyze service performance directly from K9s. |
Plugins | Extend K9s functionality with other tools and scripts. | Integrate custom plugins to enhance capabilities. |
Every Bit of Support Helps!
If you have enjoyed this post, please consider buying me a coffee ☕ to help me keep writing!