https://github.com/stvnksslr/khelp
A user-friendly CLI tool to manage Kubernetes contexts with ease.
https://github.com/stvnksslr/khelp
cli k8s kubernetes rust
Last synced: 7 months ago
JSON representation
A user-friendly CLI tool to manage Kubernetes contexts with ease.
- Host: GitHub
- URL: https://github.com/stvnksslr/khelp
- Owner: stvnksslr
- Created: 2025-03-25T18:18:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-28T20:19:45.000Z (over 1 year ago)
- Last Synced: 2025-04-30T20:59:00.998Z (about 1 year ago)
- Topics: cli, k8s, kubernetes, rust
- Language: Rust
- Homepage: https://crates.io/crates/khelp
- Size: 124 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# khelp(er)
A command-line tool for managing Kubernetes contexts.
## Overview
khelp simplifies working with kubeconfig files by providing intuitive commands to list, switch, import, export, and manage Kubernetes contexts.
## Installation
### Quick Install
**Linux / macOS:**
```bash
curl -fsSL https://files.stvnksslr.com/khelp/install.sh | bash
```
**Windows (PowerShell):**
```powershell
irm https://files.stvnksslr.com/khelp/install.ps1 | iex
```
### From Source
```bash
git clone https://github.com/stvnksslr/khelp.git
cd khelp
cargo build --release
```
The binary will be available at `target/release/khelp`.
### With Self-Update Feature
```bash
cargo build --release --features self_update
```
## Platform Support
- Linux
- macOS
- Windows
## Commands
| Command | Description |
|---------|-------------|
| `list` | List all available contexts (current context marked with *) |
| `current` | Display details about the active context |
| `switch [name]` | Switch to a different context (interactive if no name given) |
| `edit [name]` | Edit a context configuration in your default editor |
| `export [names...]` | Export one or more contexts to stdout in YAML format |
| `delete [name]` | Delete a context and its orphaned cluster/user (supports --force) |
| `cleanup` | Remove orphaned clusters and users not referenced by any context |
| `rename ` | Rename an existing context |
| `add ` | Import contexts from an external kubeconfig file |
| `completions [shell]` | Generate shell completions (bash, zsh, fish, powershell, elvish) |
| `update` | Check for and apply updates (requires self_update feature) |
## Usage Examples
List all contexts:
```bash
khelp list
```
Switch to a context interactively:
```bash
khelp switch
```
Switch to a specific context:
```bash
khelp switch my-cluster
```
Import contexts from another kubeconfig:
```bash
khelp add ~/Downloads/new-cluster.yaml
```
Import with automatic rename for conflicts:
```bash
khelp add ~/Downloads/cluster.yaml --rename
```
Export a context for backup:
```bash
khelp export my-cluster > my-cluster-backup.yaml
```
Export multiple contexts at once:
```bash
khelp export dev-cluster staging-cluster prod-cluster > all-clusters.yaml
```
Delete a context (automatically removes orphaned cluster/user):
```bash
khelp delete old-cluster
```
Clean up any orphaned clusters and users:
```bash
khelp cleanup
```
Install shell completions:
```bash
khelp completions --install
```
## Shell Completions
Generate completions for your shell:
```bash
# Bash
khelp completions bash >> ~/.bash_completion.d/khelp
# Zsh
khelp completions zsh > ~/.zfunc/_khelp
# Fish
khelp completions fish > ~/.config/fish/completions/khelp.fish
# PowerShell (add to $PROFILE)
khelp completions powershell >> $PROFILE
```
Or use automatic installation:
```bash
khelp completions --install
```
## License
MIT