https://github.com/rvojcik/kube-shell
Shell function for Kubernetes clusters. Fast way to work with kubernetes contexts, namespaces and multiple contexts in many shells. Work on multiple clusters at once
https://github.com/rvojcik/kube-shell
bash k8s kubectl kubernetes shell
Last synced: 3 months ago
JSON representation
Shell function for Kubernetes clusters. Fast way to work with kubernetes contexts, namespaces and multiple contexts in many shells. Work on multiple clusters at once
- Host: GitHub
- URL: https://github.com/rvojcik/kube-shell
- Owner: rvojcik
- Created: 2021-05-27T16:09:53.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-08-12T08:48:57.000Z (almost 2 years ago)
- Last Synced: 2025-10-08T23:00:01.641Z (9 months ago)
- Topics: bash, k8s, kubectl, kubernetes, shell
- Language: Shell
- Homepage:
- Size: 13.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kube-shell
Kubernetes shell bash functions to help working with multiple kubernetes clusters.
- switch between namespaces easily
- switch easily between clusters
- fork kubeconfig to work with multiple clusters / namespaces in separate shells
- send commands to multiple contexts at once with `krun`
## Demo
### Working on multiple contexts at once
Great for cluster operators, check your deployments across infrastructure or deploy changes to multiple contexts.

### Forking Kube Config in separate shell
Sometimes it's handy to have two contexts in two shells

There are also [Demos for basic functions](https://github.com/rvojcik/kube-shell/tree/main/img) like switching context, switching between last contexts and namespaces.
## Installation
Add sourcing to your `.bash_rc` file like
```
source /path/to/kubeshell.sh
```
or directly from shell
```
bash# source ./kubeshell.sh
```
## Usage
- `kcon`, change context, `--` or `-` for switching between last contexts
- `kname`, change namespace, `--` or `-` for switching between last namespaces
- `kfork`, fork kubeconfig to separate instance, can operate on different cluster in every shell, `del` for destroying fork and returning to main kubeconfig file
- `krun`, send commands to multiple contexts at once
### krun
For list contexts where commands will be send
```
krun
```
Add context to krun
```
krun + context_name
```
Remove context from krun
```
krun - context_name
```
You can also add or remove all contexts with `ALL`
```
krun + ALL
```
Get kube-system pods from contexts
```
krun get pods -n kube-sytem
```