Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onatm/kubectl-allctx
Run 'kubectl' commands on contexts in your kubeconfig
https://github.com/onatm/kubectl-allctx
kubectl kubectl-plugin kubectl-plugins kubernetes kubernetes-contexts power-tools
Last synced: 2 months ago
JSON representation
Run 'kubectl' commands on contexts in your kubeconfig
- Host: GitHub
- URL: https://github.com/onatm/kubectl-allctx
- Owner: onatm
- License: mit
- Created: 2020-10-16T20:43:13.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-10-19T09:42:29.000Z (about 4 years ago)
- Last Synced: 2024-10-13T02:13:02.978Z (3 months ago)
- Topics: kubectl, kubectl-plugin, kubectl-plugins, kubernetes, kubernetes-contexts, power-tools
- Language: Shell
- Homepage:
- Size: 6.84 KB
- Stars: 18
- Watchers: 3
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kubectl-allctx: `kubectl` without context switch
Run 'kubectl' commands on contexts in your kubeconfig
## Usage
### `apply`
```bash
$ kubectl allctx apply -f deployment.yamlContext: north-america
deployment.apps/awesome-deployment createdContext: west-europe
deployment.apps/awesome-deployment created
```### `get pods`
```bash
$ kubectl allctx get podsContext: north-america
NAME READY STATUS RESTARTS AGE
awesome-app-68d74656c5-rzt2z 1/1 Running 0 108d
awesome-resources-79c896db67-g4d5f 1/1 Running 0 108d
awesome-web-68bd99bb44-x5gg8 1/1 Running 0 108d
grafana-777564df5d-dcl4w 2/2 Running 0 74dContext: west-europe
NAME READY STATUS RESTARTS AGE
awesome-app-d7fb8dc96-6w22g 1/1 Running 0 105d
awesome-resources-777564df5d-dcl4w 1/1 Running 0 105d
awesome-web-6449f64fcd-pgphp 1/1 Running 0 105d
grafana-9c57bcc66-f7t9w 2/2 Running 0 74d$ kubectl allctx get pods --like app
Context: north-america
awesome-app-68d74656c5-rzt2z 1/1 Running 0 108dContext: west-europe
awesome-app-d7fb8dc96-6w22g 1/1 Running 0 105d
```### `get deploy`
```bash
$ kubectl allctx get deployContext: north-america
NAME READY UP-TO-DATE AVAILABLE AGE
awesome-app 1/1 1 1 108d
awesome-resources 1/1 1 1 108d
awesome-web 1/1 1 1 108d
grafana 1/1 1 1 74dContext: west-europe
NAME READY UP-TO-DATE AVAILABLE AGE
awesome-app 1/1 1 1 105d
awesome-resources 1/1 1 1 105d
awesome-web 1/1 1 1 105d
grafana 1/1 1 1 74d$ kubectl allctx get deploy --like grafana
Context: north-america
grafana 1/1 1 1 74dContext: west-europe
grafana 1/1 1 1 74d
```### `get pv`
```bash
$ kubectl allctx get pvContext: north-america
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-70ab5227-3dc5-4901-9a3d-9c8542c9f379 10Gi RWO Delete Bound amazing-namespace/grafana default 74dContext: west-europe
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-8f02ad08-df03-42d9-a9bf-d93338157d15 10Gi RWO Delete Bound amazing-namespace/grafana default 74d
```etc.
## Installation
### Kubectl Plugins (macOS and Linux)
You can install and use [Krew](https://github.com/kubernetes-sigs/krew/) kubectl plugin manager to get `kubectl-all`.
```bash
kubectl krew install allctx
```### Manual
You should be able to install `kubectl-allctx` in any POSIX environment where `Bash` is installed.
- Download `kubectl-allctx`.
- Either:
- save it to somewhere in your `PATH`,
- or save it to a directory, then create a symlink to `kubectl-allctx` from somewhere in your `PATH`, like `/usr/local/bin`
- Make `kubectl-allctx` executable (`chmod +x kubectl-allctx`)#### Example installation
```bash
sudo git clone https://github.com/onatm/kubectl-allctx /opt/kall
sudo ln -s /opt/kall/kubectl-allctx /usr/local/bin/kubectl-allctx
```