Skip to content

Lightning Talk: Kubernetes Cluster Interactions Simplified with K9s

Arka Bhattacharya

CloudThe Linux Foundation6 minIntermediateOpen on YouTube ↗

Examines lightning Talk: Kubernetes Cluster Interactions Simplified with K9s and evaluates key implications for security practitioners.

Summary

# Overview In this lightning talk, Arco Bhattacharya from Solo introduces K9s, a terminal-based user interface (TUI) designed to simplify interactions with Kubernetes clusters. Having used kubectl, cheat sheets, aliases, and the kubectl zsh plugin early in his Kubernetes journey, the speaker highlights how adopting K9s streamlined his workflow by replacing cumbersome command-line commands with intuitive, single-keystroke operations inside a terminal.

# Key Topics - **Transition from kubectl CLI to K9s:** Managing Kubernetes resources efficiently without repetitive CLI commands or bookmarks. - **Real-Time Resource Visibility:** Navigating namespaces, pods, and deployments directly within the terminal UI. - **Resource Management & Actions:** Deleting, scaling, searching, and batch-modifying cluster objects. - **Application Access & Secrets:** Handling port forwarding and decoding Kubernetes secrets directly inside the interface. - **Troubleshooting & Multi-Cluster Scenarios:** Inspecting live container logs and monitoring multi-cluster failover testing across environments.

# Technical Details - **Cluster & Pod Exploration:** Launching `k9s` starts in the default namespace. Pressing `0` switches to view all pods across namespaces, such as `kube-system` or newly created namespaces like `argo-cd`. Selecting a pod reveals container details, container images, readiness checks, init container completion status, and exposed ports. - **Object Deletion:** Pressing `Ctrl + D` on a highlighted object (e.g., pod or deployment) deletes it immediately. - **Navigation & Scaling:** Typing `:deploy` (or pressing `Escape` then `:deploy`) lists all cluster deployments. Pressing `s` prompts to adjust the replica count. Batch operations are performed by filtering with `/` (e.g., `/server`), multi-selecting resources using `Spacebar`, and scaling them concurrently with `s`. - **Port Forwarding:** Pressing `Shift + F` opens port-forward configuration with suggested container ports, allowing forwarding to local ports such as `localhost:8080`. - **Secrets Decoding:** Navigating to `:sec` displays Kubernetes secrets. Pressing `x` decodes the base64 secret value with a single keystroke for quick retrieval. - **Log Inspection:** Pressing `l` on a selected pod streams live logs, with `f` toggling full-screen mode and `w` toggling word wrap. - **Multi-Cluster Contexts & Failover Testing:** Using `:context` or `:ctx` allows switching contexts between clusters. In a demonstration setup featuring two clusters with Istio deployed across regions (`us-east-2` and `us-west-1`), the speaker tail logs in both clusters simultaneously. When scaling the active `us-east-2` deployment to zero replicas, live curls demonstrate immediate failover to `us-west-1` without dropped requests.

# Takeaways K9s delivers rapid cluster navigation, real-time observability, and straightforward resource manipulation directly in the terminal. Key shortcuts like `s` (scale), `Shift + F` (port-forward), `x` (decode secret), and `l` (logs) significantly reduce administrative overhead and accelerate troubleshooting during both single-cluster maintenance and complex multi-cluster testing.

Related talks