Khelp(er)
A user-friendly CLI tool to manage Kubernetes contexts with ease.
Features
- 🔍 List all available Kubernetes contexts
- 👁️ View the current active context with details
- 🔄 Switch between contexts with interactive selection
- ✏️ Edit context configurations with your preferred editor
- 📤 Export specific contexts for sharing or backup
- 🔄 Update to the latest version using built-in self-update
- 🛠️ Shell Completions for bash, zsh, and fish
Installation
easy install script, source located at install.sh
|
From Cargo
Usage
Overview
)
List
View all available Kubernetes contexts in your configuration:
Example output:
Kubernetes available contexts:
------------------------
* minikube
production
staging
development
Current
Display details about the currently active context:
Example output:
Current context: minikube
Cluster: minikube
User: minikube
Namespace: default
Switch
Switch to a different context:
This will display an interactive menu to select the target context. You can also specify the context directly:
Edit
Open a context configuration in your default editor:
Or specify a context to edit:
The tool will open your default editor (defined by $EDITOR or $VISUAL environment variables) with the context configuration. Changes are automatically saved back to your Kubernetes config file with a backup created.
Export
Export a specific context configuration to stdout:
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: example
server: https://192.168.64.2:8443
name: dev
contexts:
- context:
cluster: dev
user: dev-user
namespace: default
name: dev
current-context: dev
kind: Config
preferences:
users:
- name: dev-user
user:
client-certificate-data: example
client-key-data: example
This is useful for sharing configurations or creating backups of specific contexts.
Completions
Generate shell completions for supported shells:
Where [SHELL] can be one of: bash, zsh, fish, powershell, or elvish.
Example:
# Output bash completions to stdout
# Install completions for your current shell
# Install completions for a specific shell
Installing completions will:
- Create the appropriate completions directory if needed
- Generate and save the completion script
- Update your shell configuration file to load the completions
- Make the script executable
After installing completions, you'll need to restart your shell or source your configuration file:
# For bash
# For zsh
# For fish
# No action needed, fish loads completions automatically
Update
Check for and apply updates to khelp:
# Check for updates (without applying)
# Check for and apply updates
The update command connects to GitHub to check for new releases. If a newer version is available, it can automatically download and update your installation.
Environment Variables
EDITORorVISUAL: Specifies the editor to use when editing context configurations (defaults tovion Unix systems andnotepadon Windows)
License
This project is licensed under the MIT License - see the LICENSE file for details.