K9s - Kubernetes Terminal UI¶
K9s is a terminal-based UI for managing Kubernetes clusters. It provides real-time monitoring and interactive navigation that's faster than using kubectl alone.
Getting Started¶
K9s is already installed in your lab environment. Simply launch it with:
Additional Launch Options¶
Basic Navigation¶
Main Interface¶
When you launch K9s, you'll see:
┌─ K9s - Pods [default] ─────────────────────────────────────────────────────────┐
│ Context: my-cluster | Cluster: v1.28.0 | User: admin │
├───────────────────────────────────────────────────────────────────────────────┤
│ NAME READY STATUS RESTARTS AGE IP NODE │
│ ●nginx-deployment-abc 1/1 Running 0 5m 10.1.1.10 worker-1 │
│ ●postgres-xyz 1/1 Running 0 10m 10.1.1.11 worker-2 │
├───────────────────────────────────────────────────────────────────────────────┤
│ <pod> [l]ogs [d]escribe [e]dit [s]hell [y]aml [/]filter [:]cmd │
└───────────────────────────────────────────────────────────────────────────────┘
Essential Shortcuts¶
Key | Action |
---|---|
: |
Enter command mode |
/ |
Filter resources |
ESC |
Go back |
q |
Quit current view |
CTRL+C |
Exit K9s |
? |
Show help |
Resource Navigation¶
Command | Description |
---|---|
:pods |
View pods |
:svc |
View services |
:deploy |
View deployments |
:nodes |
View nodes |
:ns |
View namespaces |
:events |
View events |
Working with Pods¶
Pod Operations¶
Key | Action |
---|---|
ENTER |
Describe pod |
l |
View logs |
s |
Shell into pod |
d |
Delete pod |
y |
View YAML |
Log Viewing¶
Press l
on any pod to view logs:
┌─ Logs [nginx-deployment-abc] ──────────────────────────────────────────────────┐
│ 2024-01-15 10:30:01 [INFO] Starting nginx server │
│ 2024-01-15 10:30:01 [INFO] Listening on port 80 │
├────────────────────────────────────────────────────────────────────────────────┤
│ [f]ollow [w]rap [s]ave [/]search [ESC]back │
└────────────────────────────────────────────────────────────────────────────────┘
Key | Action |
---|---|
f |
Follow logs |
/ |
Search logs |
w |
Toggle wrap |
ESC |
Go back |
Filtering and Context¶
# Filter by name
/nginx
# Filter by labels
/app=nginx
# Switch namespace
CTRL+N
# View all namespaces
0
Run:AI Specific Usage¶
Monitor Run:AI System¶
# View Run:AI components
:pods
/runai-system
# Check GPU nodes
:nodes
# Press ENTER on node to see GPU details
Debug Workloads¶
# Find your workload
:pods
/runai-<project>
# View workload logs
l
# Check events
:events
/your-workload
Quick Tips¶
- Start with overview:
:pods
to see all running workloads - Use filters:
/
to focus on specific resources - Follow logs:
l
thenf
for real-time log monitoring - Check events:
:events
when troubleshooting issues - Shell access:
s
to debug inside containers
Comparison with kubectl¶
Task | kubectl | K9s |
---|---|---|
List pods | kubectl get pods |
:pods |
Pod logs | kubectl logs <pod> |
Select pod + l |
Shell access | kubectl exec -it <pod> -- bash |
Select pod + s |
Describe | kubectl describe pod <pod> |
Select pod + ENTER |
Delete | kubectl delete pod <pod> |
Select pod + d |
K9s provides the same functionality as kubectl but with real-time updates, interactive navigation, and visual context that makes cluster management much faster.