Skip to content

DRINGOT/kli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

KLI - Kubernetes Lens Interface

Version License Shell

KLI is a modern and interactive command-line interface for Kubernetes, designed to simplify cluster navigation and management through a rich user interface based on fzf.

  _  ___      _____
 | |/ / |    |_   _|
 | ' /| |      | |
 | . \| |___  _| |_
 |_|\_\_____||_____|

โœจ Features

  • ๐ŸŽฏ Smart Navigation - Interactive interface with real-time preview
  • ๐Ÿ”„ Context Switching - Quick switching between Kubernetes clusters
  • ๐Ÿ“ฆ Resource Explorer - Visualization and management of all K8s resources
  • ๐Ÿ” Live Preview - Display logs, YAML and status in real-time
  • โšก Performance - Optimal use of fzf for a smooth experience
  • ๐ŸŽจ Modern UI - Colorful interface with symbols and visual status
  • ๐Ÿ› ๏ธ Kubectl Actions - Execute kubectl commands (get, describe, logs, edit, delete, etc.)

๐Ÿ“‹ Prerequisites

Required

  • kubectl - Kubernetes CLI
  • fzf - Fuzzy finder (>= 0.27.0 recommended)

Optional

  • jq - For advanced JSON parsing
  • Metrics Server (for top commands)

๐Ÿš€ Installation

Homebrew (Recommended)

brew tap DRINGOT/tap
brew install DRINGOT/tap/kli

Quick Install

# Clone the repository
git clone https://github.com/DRINGOT/kli.git
cd kli

# Run the installation
./install.sh

The installation script will:

  1. Check system dependencies
  2. Copy binaries to /usr/local/bin
  3. Configure appropriate permissions

Manual Installation

# Copy files
sudo cp kli kli-ctx kli-engine kli-ns kli-run /usr/local/bin/
sudo cp kli-ui VERSION /usr/local/bin/

# Make scripts executable
sudo chmod +x /usr/local/bin/kli*

๐Ÿ“– Usage

Main Interactive Mode

kli

Launches the main interface with the home menu allowing you to:

  • Start the resource explorer
  • Switch Kubernetes context
  • Switch namespace
  • Launch the initialization wizard

Direct Commands

# Switch Kubernetes context
kli ctx

# Switch namespace
kli ns

# Launch the demo wizard
kli run

# Start explorer directly
kli --explorer

# Set initial namespace
kli -n monitoring
kli --namespace production

Available Options

OPTIONS:
  -n, --namespace <ns>   Set initial namespace
  --explorer             Jump directly to resource explorer
  -h, --help             Show this help message
  -v, --version          Show version

COMMANDS:
  ctx                    Switch cluster context
  ns                     Quick namespace switch
  run                    Start the demo/wizard mode

๐ŸŽฎ User Interface

Keyboard Navigation

  • ENTER : Select / Validate
  • ESC : Return to previous menu
  • Ctrl+C : Exit cleanly
  • โ†‘/โ†“ : Navigate through lists
  • Type to search : Dynamic filtering

Navigation Flow

HOME
 โ”œโ”€โ”€ START EXPLORER
 โ”‚    โ””โ”€โ”€ NAMESPACE
 โ”‚         โ””โ”€โ”€ ACTION (get, describe, logs, edit, etc.)
 โ”‚              โ””โ”€โ”€ RESOURCE (pods, services, deployments, etc.)
 โ”‚                   โ””โ”€โ”€ ITEM (specific selection)
 โ”œโ”€โ”€ SWITCH CONTEXT (kli-ctx)
 โ”œโ”€โ”€ SWITCH NAMESPACE (kli-ns)
 โ””โ”€โ”€ RUN WIZARD (kli-run)

๐Ÿ—๏ธ Architecture

The project consists of several modules:

  • kli - Main entry point and orchestrator
  • kli-ctx - Context switching module with node preview
  • kli-ns - Namespace switching module with pod overview
  • kli-engine - Kubectl action execution engine with colorization
  • kli-run - Interactive wizard for onboarding
  • kli-ui - Shared UI library (colors, symbols, rendering functions)

File Structure

kli/
โ”œโ”€โ”€ kli                 # Main binary
โ”œโ”€โ”€ kli-ctx            # Context switcher
โ”œโ”€โ”€ kli-ns             # Namespace switcher
โ”œโ”€โ”€ kli-engine         # Data fetcher
โ”œโ”€โ”€ kli-run            # Interactive wizard
โ”œโ”€โ”€ kli-ui             # UI library
โ”œโ”€โ”€ install.sh         # Installation script
โ”œโ”€โ”€ VERSION            # Version file
โ”œโ”€โ”€ LICENSE            # GPL v3 License
โ””โ”€โ”€ README.md          # Documentation

๐ŸŽจ Visual Features

Smart Colorization

Statuses are automatically colorized:

  • ๐ŸŸข Green : Running, Active, Ready, Succeeded
  • ๐ŸŸก Yellow : Pending, ContainerCreating, Progressing
  • ๐Ÿ”ด Red : Failed, Error, CrashLoopBackOff, OOMKilled

Real-Time Preview

  • Contexts : Display nodes, endpoints and metrics
  • Namespaces : List pods and their statuses
  • Resources : Detailed YAML and recent logs

๐Ÿ”ง Configuration

KLI uses the standard kubectl configuration (~/.kube/config) and requires no additional configuration.

๐Ÿ› Troubleshooting

"Cluster unreachable" Error

# Check cluster connection
kubectl cluster-info

# Check current context
kubectl config current-context

# Use kli ctx to switch context
kli ctx

fzf not found

# macOS
brew install fzf

# Ubuntu/Debian
sudo apt install fzf

# Arch Linux
sudo pacman -S fzf

๐Ÿ“ Usage Examples

Typical Workflow

# 1. Check/switch context
kli ctx

# 2. Select a namespace
kli ns

# 3. Explore resources
kli --explorer

# Or all in one command
kli -n production

Available Actions in Explorer

  • get - List resources
  • describe - Complete details of a resource
  • logs - View logs (pods)
  • edit - Edit YAML configuration
  • top - CPU/RAM metrics
  • delete - Delete a resource
  • explain - Resource documentation
  • rollout - Manage deployments
  • scale - Scale a resource

๐Ÿค Contributing

Contributions are welcome! Feel free to:

  • Open issues to report bugs
  • Submit pull requests for new features
  • Improve documentation

๐Ÿ“„ License

This project is distributed under the GNU General Public License v3.0. See the LICENSE file for more details.

๐Ÿ‘ค Author

Donovan Ringot

๐Ÿ™ Acknowledgments

  • kubectl - Official Kubernetes CLI
  • fzf - The fuzzy finder that makes this all possible
  • The Kubernetes community

KLI - Making Kubernetes management interactive and enjoyable! ๐Ÿš€

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages