Mastering Kubernetes with K9s

Swetha Dulgunti
2 min readAug 27, 2024

--

Kubernetes (K8s) is a powerful tool for managing containerized applications, but it can be complex and challenging to navigate. Enter K9s, a terminal-based UI designed to simplify the management of Kubernetes clusters. In this article, we’ll explore how to use K9s, its advantages, and some handy shortcuts to boost your productivity.

Getting Started with K9s

Installation: K9s can be installed on various operating systems. Here are some common methods:

macOS/Linux: Use Homebrew

brew install k9s

Windows: Use Chocolatey

choco install k9s

Linux: Use Snap

snap install k9s --classic

Launching K9s:

Once installed, you can start K9s by simply typing k9s in your terminal. It will automatically connect to your Kubernetes cluster using the context set in your kubeconfig file.

Navigating K9s

K9s provides a real-time view of your Kubernetes resources. Here are some key navigation tips:

  • Resource View: By default, K9s opens in the pod view. You can switch to other resources like services, deployments, and nodes using the : command followed by the resource name (e.g., :svc for services).
  • Filtering: Use / to filter resources by name.
  • Details: Press Enter on a resource to view its details.
  • Logs: Press l to view logs for a selected pod.

Advantages of Using K9s

  1. User-Friendly Interface: K9s offers an intuitive and visually appealing interface, making it easier to manage Kubernetes resources compared to the traditional kubectl commands.
  2. Real-Time Monitoring: It continuously monitors your cluster, providing real-time updates on resource status.
  3. Resource Management: K9s supports inline editing, allowing you to modify resources directly within the interface.
  4. Customizable: You can customize the look and feel of K9s using skins and configure shortcuts for quick navigation.
  5. Enhanced Productivity: With features like resource filtering, error zoom, and built-in benchmarking, K9s significantly enhances your productivity2.

Handy Shortcuts

Here are some essential shortcuts to help you navigate K9s more efficiently:

General:

  • :q - Quit K9s
  • :help - Display help menu
  • :ctx - Switch context

Navigation:

  • / - Filter resources
  • : - Command mode
  • Esc - Exit current view

Resource Actions:

  • d - Describe resource
  • e - Edit resource
  • l - View logs
  • r - Restart pod
  • s - Shell into pod

Conclusion

K9s is a powerful tool that simplifies Kubernetes cluster management, making it more accessible and efficient. Whether you’re a developer or an administrator, K9s can help you navigate, observe, and manage your Kubernetes resources with ease. By leveraging its user-friendly interface, real-time monitoring, and customizable features, you can significantly enhance your productivity and streamline your Kubernetes operations.

Happy clustering! 🚀

References

K9s — Manage Your Kubernetes Clusters In Style

Maximizing Productivity with Kubernetes: The Benefits of Using K9s

https://www.youtube.com/watch?v=YXfnoL4VEiE&t=3s

--

--

No responses yet