KCC is a CLI tool that helps you easily switch between Kubernetes cluster contexts in your kubeconfig file. It provides an interactive selector interface for choosing the desired context.
- List all available Kubernetes contexts.
- Interactive CLI for selecting and switching contexts.
- Lightweight and easy to use.
-
Clone the repository:
git clone https://github.com/asudarsanan/kcc.git cd kcc -
Build the project:
Ensure you have Go installed on your machine. Then run:
go build -o kcc
-
Move the executable to a directory in your PATH:
# On macOS and Linux: sudo mv kcc /usr/local/bin/ # or `sudo install kcc /usr/local/bin/kcc` # On Windows: move kcc.exe C:\path\to\directory\in\PATH\
-
Ensure the directory is in your PATH:
Add the following line to your
~/.bashrc,~/.bash_profile, or~/.zshrcfile:export PATH=$PATH:/usr/local/bin
Then source the file:
source ~/.bashrc # or ~/.bash_profile or ~/.zshrc
- Open the Start Search, type in "env", and choose "Edit the system environment variables".
- In the System Properties window, click on the "Environment Variables" button.
- In the Environment Variables window, select the
Pathvariable in the "System variables" section and click "Edit". - Click "New" and add the path to the directory where you moved
kcc.exe, e.g.,C:\path\to\directory\in\PATH. - Click "OK" to close all windows.
After building the project and adding it to your PATH, you can run the kcc executable to interactively select and switch between your Kubernetes contexts.
kccSelect Kubernetes cluster context:
❯ context-1
context-2
context-3Select the context you want to switch to, and press Enter. The tool will switch to the selected context and output:
Switched to context context-1To contribute to this project, follow these steps:
Fork the repository:
Click the "Fork" button at the top right corner of this repository's GitHub page.
Clone your fork:
git clone https://github.com/asudarsanan/kcc.git
cd kccCreate a new branch:
git checkout -b feature-branch-nameMake your changes and commit them:
git add .
git commit -m "Description of changes"Push to your fork and create a pull request:
git push origin feature-branch-nameThis project is licensed under the MIT License. See the LICENSE file for details.
If you have any questions, feel free to open an issue or contact the project maintainer at X.