π K9s Practical Guide β From Installation to Usage
K9s is a terminal-based UI for managing Kubernetes clusters. It provides a more intuitive and interactive way to explore resources, view logs, and execute commands compared to raw kubectl.
1. π§ Installation
Linux / macOS
# Install via curl
curl -sS https://webinstall.dev/k9s | bash
# Or via brew (macOS/Linux with Homebrew)
brew install derailed/k9s/k9sWindows
choco install k9sβ After installation, verify:
k9s version2. βοΈ Setup
- K9s uses your existing kubeconfig (usually
~/.kube/config). - Ensure you can access your cluster:
kubectl get nodes- Then simply run:
k9sK9s will auto-detect the current context and namespace.
3. π§ Navigation
* **Arrow keys / j k** β Move through resources
* **Enter** β Drill down into resource details
* **:q** β Quit current view
* **:ns <namespace>** β Switch namespace
* **:ctx <context>** β Switch cluster context
* **/search** β Filter resources
* **d** β Describe resource (like `kubectl describe`)
* **l** β View logs of a pod
* **s** β Shell into a pod (exec)
* **Shift+0** β Show all namespaces4. π Common Workflows
π View Pods
k9s
# Navigate to Pods β press Enterπ View Pod Logs
- Select pod β press
l - For specific container β press
0-9to switch
π Exec into Pod
- Select pod β press
s - Opens interactive shell inside container
π¦ Manage Deployments
- Navigate to Deployments
- Press
dto describe - Press
eto edit (opens YAML in editor)
5. π¨ Customization
-
Config stored in:
~/.k9s/config.yml -
You can set:
- Theme (skins)
- Default namespace
- Keybindings
Example config snippet:
k9s:
refreshRate: 2
ui:
skin: onedark
namespace:
active: default6. π Tips & Shortcuts
:β Command mode?β Show help & shortcutsShift+gβ Jump to bottom of listCtrl+aβ View all resourcesShift+cβ Switch cluster context
7. β Summary
K9s makes Kubernetes management faster and more intuitive:
- No need to remember complex
kubectlcommands - Easy navigation through pods, deployments, logs
- Supports exec, editing, scaling, and context switching
- Customizable interface for personal workflow
π₯ With K9s, youβll save tons of time navigating and debugging your Kubernetes clusters.