A minimal kubectl
plugin written in Go to reload and inspect your local kubeconfig contexts. This tool is particularly useful for local development environments like kind
where you might frequently update your kubeconfig.
- Reload: Fetches and displays the latest contexts from your kubeconfig file.
- List Contexts: Clearly lists all available Kubernetes contexts.
- Validation: Confirms that the kubeconfig is available and loaded correctly.
- Lightweight: Simple and fast, with no external dependencies outside of the standard Go libraries and
spf13/cobra
.
- Go installed on your machine.
kubectl
installed and configured.
-
Clone the repository:
git clone https://github.com/maheshbhatiya73/kubectl-kctx.git
-
Navigate to the project directory:
cd kubectl-kctx
-
Build the binary:
go build -o kubectl-kctx
-
Make the binary executable:
chmod +x kubectl-kctx
-
Move the binary to your PATH:
sudo mv kubectl-kctx /usr/local/bin/
To use the plugin, run the following command:
kubectl kctx reload
Reloading kubeconfig from ~/.kube/config...
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* kind-test-cluster kind-test-cluster kind-test-cluster
Kubeconfig is available and loaded.
Command | Description |
---|---|
reload |
Reloads and validates the kubeconfig file. |
This plugin is built with Go and the spf13/cobra library.
To build the plugin for development, run:
go build -o kubectl-kctx
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
© 2025 Mahesh Bhatiya