https://github.com/postfinance/kubectl-ctx
Simple kubectl plugin to display/switch contexts
https://github.com/postfinance/kubectl-ctx
golang kubectl kubectl-plugins kubernetes
Last synced: 5 months ago
JSON representation
Simple kubectl plugin to display/switch contexts
- Host: GitHub
- URL: https://github.com/postfinance/kubectl-ctx
- Owner: postfinance
- License: mit
- Archived: true
- Created: 2018-10-04T13:04:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-09-08T06:16:30.000Z (almost 4 years ago)
- Last Synced: 2024-06-19T01:56:26.913Z (almost 2 years ago)
- Topics: golang, kubectl, kubectl-plugins, kubernetes
- Language: Go
- Size: 97.7 KB
- Stars: 35
- Watchers: 6
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://github.com/postfinance/kubectl-ctx/releases/latest)
[](/LICENSE.md)
[](https://goreportcard.com/report/github.com/postfinance/kubectl-ctx)
# THIS PLUGIN IS ARCHIVED.
Please use [kubectx](https://github.com/ahmetb/kubectx) instead.
# kubectl ctx plugin
Simple Plugin to display/change the current kube context in your KUBECONFIG.
# Installation
Pre-compiled statically linked binaries are available on the [releases page](https://github.com/postfinance/kubectl-ctx/releases).
Binary must be placed anywhere in `$PATH` named `kubectl-ctx` with execute permissions.
For further information, see the offical documentation on plugins [here](https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/).
# Compatibility
Known to work on Windows and Linux. Requires kubectl >= 1.12 (tested with versions >1.12).
# Examples
For all the examples, assume you have the following contexts.
```
foo
bar
baz
localhost
```
## display contexts
Current context is displayed in a different color.
```bash
$ kubectl ctx
bar
baz
foo
localhost
```
Substring matching can be used to display contexts. For example if you are searching a context named `ba` simply type:
```bash
$ kubectl ctx ba
bar
baz
```
## change current context
You can switch the context by providing an exact name:
```bash
$ kubectl ctx foo
current context set to "foo"
```
But it's also possible to switch to the `localhost` context by typing a substring (as long as it is a unique name), for example:
```bash
$ kubectl ctx local
current context set to "localhost"
```