https://github.com/postfinance/kubectl-ns
Simple kubectl plugin to display/switch namespaces
https://github.com/postfinance/kubectl-ns
golang kubectl kubectl-plugins kubernetes
Last synced: 15 days ago
JSON representation
Simple kubectl plugin to display/switch namespaces
- Host: GitHub
- URL: https://github.com/postfinance/kubectl-ns
- Owner: postfinance
- License: mit
- Archived: true
- Created: 2018-10-04T13:43:14.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-09-08T06:13:33.000Z (over 2 years ago)
- Last Synced: 2024-11-02T06:31:53.747Z (5 months ago)
- Topics: golang, kubectl, kubectl-plugins, kubernetes
- Language: Go
- Size: 106 KB
- Stars: 21
- Watchers: 7
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-kubectl-plugins - kubectl-ns - ns)](https://github.com/postfinance/kubectl-ns/stargazers) | (kubectl Plugins / Installing plugins via awesome-kubectl-plugins)
README
[](https://github.com/postfinance/kubectl-ns/actions)
[](https://github.com/postfinance/kubectl-ns/releases/latest)
[](/LICENSE.md)
[](https://goreportcard.com/report/github.com/postfinance/kubectl-ns)# THIS PLUGIN IS ARCHIVED.
Please use [kubectx](https://github.com/ahmetb/kubectx) instead.
# kubectl ns plugin
Simple Plugin to display/change the current kube namespace with support for substring matching.
# Build/Installation
## Build from source
go version >= 1.13 with modules support enabled is required to build the plugin from source.
```bash
export GO111MODULES=on # optional if checked out outside of $GOPATH
go build
```## Installation
Pre-compiled statically linked binaries are available on the [releases page](https://github.com/postfinance/kubectl-ns/releases).
Binary must be placed anywhere in `$PATH` named `kubectl-ns` 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).
Supports the oidc, gcp and azure auth provider for authentication against the k8s api server.# Examples
For all the examples, assume your cluster has the following namespaces:
```
default
kube-system
kube-public
ingress-nginx
foo
bar
baz
```## display namespaces
Current namespace is displayed in a different color and last.
```bash
$ kubectl ns
default
kube-system
kube-public
ingress-nginx
foo
bar
baz
```Substring matching can be used to display namespaces. For example if you are searching for a `kube-` namespace simply type:
```bash
$ kubectl ns kube-
kube-system
kube-public
```## change current namespace
You can switch the namespace by providing an exact name:
```bash
$ kubectl ns foo
namespace set to "foo"
```But it's also possible to switch to the `ingress-nginx` namespace by typing a substring (as long as it is a unique name), for example:
```bash
$ kubectl ns ingress
namespace set to "ingress-nginx"
```