https://github.com/dodevops/kc
Quick Kubernetes context switcher βΈοΈ π
https://github.com/dodevops/kc
Last synced: 8 months ago
JSON representation
Quick Kubernetes context switcher βΈοΈ π
- Host: GitHub
- URL: https://github.com/dodevops/kc
- Owner: dodevops
- License: mit
- Created: 2023-03-29T10:14:56.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-21T07:58:48.000Z (over 1 year ago)
- Last Synced: 2025-03-27T02:51:21.483Z (about 1 year ago)
- Language: Go
- Size: 51.8 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kubectl-cs - Quick Kubernetes context switcher βΈοΈ π
cs is a kubectl plugin makes it easy to switch between multiple [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/) contexts or change the default
namespace of the currently selected context.
It's heavily used while working with [CloudControl](https://cloudcontrol.dodevops.io). This is the rewrite in pure
go to replace the former bash and gnu-dialog-based tool and turn it into a kubectl plugin.
## Requirements
This tool builds upon a locally configured [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/) file and the kubectl client.
## Installation
Download the binary for your operating system and architecture from the latest
[kc release](https://github.com/dodevops/kc/releases) and put it somewhere in your path.
*Note*: Because the tool is not signed, macOS users need to enable execution when starting kc for the first time.
To do this, Ctrl-Click on the binary and select "allow".
## Usage
Run `kubectl cs` to switch to a Kubernetes context and/or namespace. You can directly specify the context to switch to
in the form of `context:namespace`. If you leave either of the two parts empty, it will only change the remaining part.
Examples:
* `kubectl cs int:` - Switch to the currently active namespace in the `int` context
* `kubectl cs :kube-system` - Switch to the namespace `kube-system` in the currently active context
* `kubectl cs int:kube-system` - Switch to the namespace `kube-system` in the `int` context
If you don't specify anything, `kubectl cs` will present a selection list of all namespaces in all contexts, which can
be filtered and selected. If that takes too long, the flag `--only-current-context` can be used, which only enumerates
the namespaces of the current context.