README
ΒΆ
kubecnf
This is fully vibe coded
Add and remove kubeconfigs from the main config file with support for piped input and comprehensive shell completions.
Usage
Info: With unspecified config file (-c / --config) default value is used (~/.kube/config)
Add a new cluster config
From a file:
kubecnf [-c /path/to/main/config] add /path/to/new/cluster/config
From piped input:
cat /path/to/new/cluster/config | kubecnf [-c /path/to/main/config] add
kubectl config view --raw | kubecnf [-c /path/to/main/config] add
echo "apiVersion: v1
kind: Config
clusters:
- cluster:
server: https://cluster.example.com
name: example-cluster
contexts:
- context:
cluster: example-cluster
user: example-user
name: example-context
users:
- name: example-user
user:
token: your-token-here" | kubecnf add
Note: You cannot use both a file argument and piped input simultaneously.
Remove a cluster config
kubecnf [-c /path/to/main/config] remove cluster-name
List all cluster configs
kubecnf [-c /path/to/main/config] list
Rollback to the previous config
kubecnf [-c /path/to/main/config] rollback
Shell Completion
kubecnf supports completion for both bash and zsh shells.
Bash Completion
To enable bash completion, source the completion script:
source <(kubecnf completion bash)
To make it permanent, add the above line to your ~/.bashrc file.
Alternatively, install system-wide (requires sudo):
kubecnf completion bash | sudo tee /etc/bash_completion.d/kubecnf
Zsh Completion
To enable zsh completion, add the completion script to your fpath:
# Add to ~/.zshrc
kubecnf completion zsh > "${fpath[1]}/_kubecnf"
Or source it directly:
source <(kubecnf completion zsh)
For Oh My Zsh users, you can place the completion file in the completions directory:
mkdir -p ~/.oh-my-zsh/completions
kubecnf completion zsh > ~/.oh-my-zsh/completions/_kubecnf
Installation
- Clone the repository
- Build the binary:
go build -o kubecnf - Move the binary to a directory in your PATH, e.g.:
sudo mv kubecnf /usr/local/bin/
Alternatively, you can download the pre-built binary directly from the GitHub release page rename it and move it to your PATH as shown above.
Using Docker
# Pull and run from GitHub Container Registry
docker pull ghcr.io/snakebiteef2000/kubecnf:latest
docker run --rm -v ~/.kube:/root/.kube ghcr.io/snakebiteef2000/kubecnf:latest --help
Using Makefile (for development)
# Install development tools and build
make dev-setup
make all
# Install locally
make install
ποΈ Development
For development instructions, testing, and contributing guidelines, see DEVELOPMENT.md.
π Features
- β Add kubeconfigs from files or piped input
- β Remove cluster configurations by name
- β List all configured clusters
- β Rollback to previous configurations
- β Shell completions for bash and zsh
- β Comprehensive input validation
- β Automatic backups
- β Duplicate detection with warnings
- β Docker container support
- β Multi-platform releases (Linux, macOS, Windows, FreeBSD)
π Project Status
This project follows professional development practices:
- π Continuous Integration: Automated testing, linting, and security scanning
- π¦ Automated Releases: Multi-platform binaries and Docker images
- π Security: Regular security scans and dependency updates
- π Code Quality: Comprehensive linting and test coverage
- π€ Automation: Dependabot for dependency management
Documentation
ΒΆ
There is no documentation for this package.