Skip to content

This tool is designed to simplify the lives of Site Reliability Engineers (SREs) and Kubernetes administrators by making it effortless to switch between different Kubernetes cluster contexts.

License

Notifications You must be signed in to change notification settings

asudarsanan/kcc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KCC (Kube Context Changer)

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.

Features

  • List all available Kubernetes contexts.
  • Interactive CLI for selecting and switching contexts.
  • Lightweight and easy to use.

Installation

  1. Clone the repository:

    git clone https://github.com/asudarsanan/kcc.git
    cd kcc
  2. Build the project:

    Ensure you have Go installed on your machine. Then run:

    go build -o kcc
  3. 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\
  4. Ensure the directory is in your PATH:

    macOS and Linux

    Add the following line to your ~/.bashrc, ~/.bash_profile, or ~/.zshrc file:

    export PATH=$PATH:/usr/local/bin

    Then source the file:

    source ~/.bashrc   # or ~/.bash_profile or ~/.zshrc

    Windows

    1. Open the Start Search, type in "env", and choose "Edit the system environment variables".
    2. In the System Properties window, click on the "Environment Variables" button.
    3. In the Environment Variables window, select the Path variable in the "System variables" section and click "Edit".
    4. Click "New" and add the path to the directory where you moved kcc.exe, e.g., C:\path\to\directory\in\PATH.
    5. Click "OK" to close all windows.

Usage

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.

kcc

Example

Running kcc:

Select Kubernetes cluster context:
  ❯ context-1
    context-2
    context-3

Select the context you want to switch to, and press Enter. The tool will switch to the selected context and output:

Switched to context context-1

Development

To 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 kcc

Create a new branch:

git checkout -b feature-branch-name

Make 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-name

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

Contact

If you have any questions, feel free to open an issue or contact the project maintainer at X.

About

This tool is designed to simplify the lives of Site Reliability Engineers (SREs) and Kubernetes administrators by making it effortless to switch between different Kubernetes cluster contexts.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages