Post

K9s Cheat Sheet

K9s Cheat Sheet

🐢 K9s Cheat Sheet

I had been looking for a k9’s for a while and have not found any that do not have advertisments so here are mine that I had Chatgpt rewrite. I have also included this as a downloadable PDF and Text file.

πŸš€ Launching K9s

1
2
3
4
5
k9s                        # Launch using default kubeconfig
k9s --kubeconfig /path     # Use specific kubeconfig
k9s --context myctx        # Use specific context
k9s --readonly             # Launch in read-only mode
k9s info                   # Show config/log paths

πŸ“ Command Mode (:)

  • :pod, :svc, :deploy, etc. β€” Go to resource view
  • :ctx β€” Change context
  • :ns β€” Change namespace
  • :aliases or Ctrl-a β€” Show resource aliases
  • :crd β€” View custom resources
  • :apiservices, :secrets, :helm β€” Specialized views
  • :xray RESOURCE β€” Show resource graph
  • :pulse β€” Cluster overview
  • :popeye or :pop β€” Run Popeye linter
  • :dir /path β€” Browse disk files (e.g., saved YAML)

πŸ” Filtering

  • /pattern β€” Regex filter
  • /!pattern β€” Inverse regex
  • /-l key=value β€” Filter by label
  • /-f value β€” Fuzzy text match

🧭 Navigation

  • j / k β€” Move down/up
  • h / l β€” Left/right in logs
  • SPACE β€” Select for bulk actions
  • Esc β€” Exit view or cancel
  • Ctrl-c or :q β€” Quit K9s

πŸ“Œ Resource Actions

  • y β€” Copy YAML
  • d β€” Describe
  • v β€” View details
  • e β€” Edit resource
  • l β€” View logs
  • s β€” Scale deployments or exec into container
  • x β€” Decode secrets
  • w β€” Toggle log line wrapping
  • f β€” Toggle full-screen mode

βš™οΈ Shortcuts & Toggles

  • Ctrl-d β€” Delete (with confirmation)
  • Ctrl-k β€” Kill immediately
  • Ctrl-w β€” Toggle wide layout
  • Ctrl-z β€” Toggle error log
  • Ctrl-e β€” Hide header
  • Ctrl-s β€” Save output to file
  • Ctrl-l β€” Rollback last apply

πŸ“Š Sorting (Shift + key)

  • Shift-c β€” Sort by CPU
  • Shift-m β€” Sort by Memory
  • Shift-s β€” Sort by Status
  • Shift-p β€” Sort by Namespace
  • Shift-n β€” Sort by Name
  • Shift-o β€” Sort by Node
  • Shift-i β€” Sort by IP
  • Shift-a β€” Sort by Age
  • Shift-t β€” Sort by Restarts
  • Shift-r β€” Sort by Readiness

πŸ› οΈ Special Views & Utilities

  • :helm β€” View Helm releases
  • :xray β€” Visualize pod relationships
  • :pulse β€” Cluster dashboard
  • :popeye β€” Run linting tool
  • :dir /path β€” Navigate file system

❓ Help & Exit

  • ? β€” Contextual help
  • Esc β€” Go back/cancel
  • :q or Ctrl-c β€” Exit K9s

πŸ’‘ Tips

  • Use f to toggle full-screen view for easier YAML copying
  • Use / to live filter resources
  • Press ? for contextual help in every view
1
2
3
4
---

Happy kuberneting 🧠🐳
This post is licensed under CC BY 4.0 by the author.