K9s Terminal Dashboard
Terminal UI for managing Kubernetes clusters.
Overview
K9s is a terminal-based user interface for managing Kubernetes clusters that transforms the complexity of kubectl commands into an intuitive, vim-like dashboard experience. Originally developed by Fernand Galiana, k9s provides real-time cluster monitoring, resource management, and troubleshooting capabilities through a single terminal window, making it an essential tool for Kubernetes administrators who prefer command-line interfaces over web-based dashboards. This Docker configuration packages k9s in a containerized environment while maintaining access to your local Kubernetes configuration, enabling you to manage clusters without installing k9s directly on your host system. The setup mounts your kubeconfig file read-only and uses host networking to ensure k9s can communicate with your Kubernetes API servers exactly as if it were running natively. This approach is particularly valuable for teams working across multiple environments or systems where installing k9s locally isn't feasible, while providing the same powerful cluster management capabilities through an isolated container runtime.
Key Features
- Real-time Kubernetes resource monitoring with automatic refresh and live updates
- Vim-style keyboard navigation and shortcuts for efficient cluster management
- Interactive resource inspection with built-in describe, logs, and shell access
- Multi-cluster support with context switching directly from the interface
- Resource filtering and search capabilities with regex pattern matching
- Pod log streaming with color syntax highlighting and follow mode
- Direct kubectl command execution through integrated shell access
- Customizable resource views with sortable columns and field selection
Common Use Cases
- 1DevOps teams managing multiple Kubernetes clusters from a standardized containerized environment
- 2CI/CD pipeline integration where k9s provides debugging capabilities without host installation
- 3Remote Kubernetes administration through SSH sessions where GUI dashboards aren't accessible
- 4Development environment troubleshooting with quick pod log analysis and resource inspection
- 5Training and learning environments where k9s can be deployed consistently across student machines
- 6Production incident response requiring rapid cluster state assessment and resource manipulation
- 7Container platform migrations where k9s provides consistent tooling across different host systems
Prerequisites
- Valid Kubernetes configuration file located at ~/.kube/config with cluster access credentials
- Network connectivity to target Kubernetes API servers from the Docker host
- Docker Engine with support for interactive TTY sessions and host networking
- At least 512MB available RAM for k9s runtime and cluster data caching
- Basic familiarity with Kubernetes resources and kubectl command concepts
- Terminal emulator supporting UTF-8 encoding and color output for proper display
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 k9s: 3 image: derailed/k9s:latest4 container_name: k9s5 stdin_open: true6 tty: true7 volumes: 8 - ~/.kube/config:/root/.kube/config:ro9 network_mode: host.env Template
.env
1# Requires valid kubeconfig at ~/.kube/configUsage Notes
- 1Docs: https://k9scli.io/
- 2Run: docker compose run k9s
- 3Navigate: arrows to move, Enter to select, Esc to go back
- 4Commands: ':pod' for pods, ':svc' for services, ':deploy' for deployments
- 5Actions: 'd' describe, 'l' logs, 's' shell, 'ctrl-d' delete
- 6Filter: '/' to search, 'ctrl-s' to save filter
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 k9s:5 image: derailed/k9s:latest6 container_name: k9s7 stdin_open: true8 tty: true9 volumes:10 - ~/.kube/config:/root/.kube/config:ro11 network_mode: host12EOF1314# 2. Create the .env file15cat > .env << 'EOF'16# Requires valid kubeconfig at ~/.kube/config17EOF1819# 3. Start the services20docker compose up -d2122# 4. View logs23docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/k9s/run | bashTroubleshooting
- Error 'unable to load configuration': Verify ~/.kube/config exists and contains valid cluster credentials with proper formatting
- Connection timeouts to API server: Check host networking configuration and ensure Docker can reach Kubernetes endpoints
- Permission denied accessing kubeconfig: Confirm the mounted config file has readable permissions and proper ownership
- K9s interface appears garbled: Ensure your terminal supports UTF-8 encoding and has sufficient width (minimum 80 columns)
- Context switching fails: Verify all contexts in kubeconfig are accessible and credentials haven't expired
- Resource views show empty data: Check RBAC permissions for the authenticated user to view cluster resources
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download