k9s
π―SkillInstallation
npx skills add g1joshi/agent-skills --skill k9sRun it in a terminal; it asks which AI coding tools to install it for (Claude Code, Codex, Cursor and more).
Uses skills.sh Β· Node.js 22.20+
After installing
Ask for related work and the agent uses it on its own, or call it yourself.
/k9sInstall by hand
Copy the whole skill folder from GitHub to the place below. Copying only SKILL.md can leave out files the skill uses.
Open the skill folder β- This project
.claude/skills/k9s/ - All projects
~/.claude/skills/k9s/
These paths are for Claude Code. For other tools, the command above puts it in the right place.
SKILL.md
View on GitHub βExpert K9s CLI assistance covering terminal Kubernetes cluster navigation, real-time log streaming, port forwarding, and pod debugging. Use when managing and troubleshooting Kubernetes clusters with speed.
K9s
K9s is a terminal UI (TUI) for Kubernetes. It is faster than clicking in a web dashboard and morediscoverable than raw kubectl.
When to Use
- Terminal-Based Kubernetes Cluster Management: Fast, interactive curses UI for navigating pods, services, and deployments.
- Real-Time Log Streaming & Resource Monitoring: Tailing multi-pod logs, sorting by CPU/memory, and port forwarding.
- Custom K9s Plugins & Aliases: Extending the CLI with custom shell commands (e.g. running stern, cert-manager status).
- Read-Only Inspection & Troubleshooting: Safely debugging production clusters with read-only modes.
Quick Start
# Launch k9s with active kubeconfig
k9s
# Navigation shortcuts in k9s:
# :pods - View all pods across namespaces
# :deploy - View deployments
# :svc - View services
# /<term> - Filter items in active view
# l - Stream logs for selected pod
# s - Open shell (exec) inside selected container
Core Concepts
Custom Plugins Configuration (plugins.yaml)
Adding custom keyboard commands for rapid debugging:
# ~/.config/k9s/plugins.yaml
plugin:
# Press 'Shift-D' on a deployment to view detailed rollout history
rollout-history:
shortCut: Shift-D
confirm: false
description: "Rollout History"
scopes:
- deployments
command: kubectl
background: false
args:
- rollout
- history
- deployment/$NAME
- -n
- $NAMESPACE
# Press 'Shift-F' on a pod to launch interactive debug container
debug-pod:
shortCut: Shift-F
confirm: true
description: "Debug Pod"
scopes:
- pods
command: kubectl
background: false
args:
- debug
- -it
- $NAME
- --image=nicolaka/netshoot
- -n
- $NAMESPACE
Essential Navigation & Keyboard Shortcuts
Accelerating cluster management:
:pod: Jump to Pod view across namespaces.:svc,:deploy,:ing: Jump to Services, Deployments, and Ingresses./: Search and filter resources by name or status.l: Tail logs for selected pod or container.s: Open an interactive shell (sh/bash) inside the selected container.Shift-F: Port-forward local port to selected pod service port.y: View full YAML manifest of selected resource.
Launching K9s with Custom Options
Starting K9s in secure modes:
# Launch in read-only mode to prevent accidental pod deletion in production
k9s --readonly --namespace production
# Specify custom context and refresh rate
k9s --context prod-eks-cluster --refresh 2
Common Patterns
Custom K9s Shortcuts and Plugins
Problem: Frequently running custom kubectl commands across different namespaces.
Solution: Define custom plugins in ~/.config/k9s/plugin.yaml.
# ~/.config/k9s/plugin.yaml
plugin:
raw-logs:
shortCut: Shift-L
description: "Tail logs without truncation"
scopes:
- pods
command: kubectl
background: false
args:
- logs
- -f
- $NAME
- -n
- $NAMESPACE
- --context
- $CONTEXT
Best Practices
Do:
- Use
k9s --readonlywhen connecting to production environments to prevent accidental deletions. - Configure custom plugins in
~/.config/k9s/plugins.yamlfor repetitivekubectlcommands. - Use the port-forward shortcut (
Shift-F) instead of typing longkubectl port-forwardcommands. - Filter views using
<all>namespaces or specific namespaces to reduce API server query loads.
Don't:
- Leave dozens of active port forwards open; manage and terminate them in the
:portforwardsview. - Run K9s against large enterprise clusters without setting appropriate
--refreshintervals. - Delete persistent volume claims (PVCs) through K9s without verifying backups.
Troubleshooting
| Error | Cause | Solution |
|---|---|---|
Boom!! K9s cannot connect to cluster | Active kubeconfig context invalid or cluster endpoint unreachable. | Verify connection: kubectl cluster-info and switch context with kubectl config use-context. |
Pod logs failing to stream in k9s | Pod container crashed or user lacks RBAC pods/log permission. | Check container status and verify cluster role permissions. |
Terminal display corrupted / artifacts | Incompatible terminal terminfo or small terminal window. | Run export TERM=xterm-256color and maximize terminal window. |
References
More from this repository10
A template skill providing a starter framework for creating new agent skills with structured sections for triggers, quick start examples, and capability descriptions.
Skill
Skill
Skill
Skill
Skill
Skill
Skill
Skill
Skill