Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lfbear/k
A shell tool for kubectl contexts switch quickly, multi-cluster
https://github.com/lfbear/k
kebectl kubernetes multi-cluster shell-script use-context
Last synced: 16 days ago
JSON representation
A shell tool for kubectl contexts switch quickly, multi-cluster
- Host: GitHub
- URL: https://github.com/lfbear/k
- Owner: lfbear
- Created: 2021-01-14T03:58:35.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-02T10:17:11.000Z (over 3 years ago)
- Last Synced: 2023-08-02T02:59:34.182Z (over 1 year ago)
- Topics: kebectl, kubernetes, multi-cluster, shell-script, use-context
- Language: Shell
- Homepage:
- Size: 166 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# k
A shell tool for kubectl contexts switch quickly, alias for `kebectl config use-context`## Prepare
The tool depends `kubectl`, assume that you can already use `kebectl`## Install
### Way 1:
`curl https://raw.githubusercontent.com/lfbear/k/main/install.sh | bash`
### Way 2
#### step 1. get code to your local
`git clone https://github.com/lfbear/k`
#### step 2. copy shell script
`cd k && sh install.sh`
### Create a Quick Command
Add `source ~/.kube/k.sh` to the bottom of your bash startup files, this file locate at one of the following file
- **[linux bash]** `~/.bashrc`
- **[Darwin native bash]** `~/.bash_profile`
- **[zsh for linux or Darwin]** `~/.zshrc`
- ...## Usage
### show all available k8s clusters
`# k`### switch the clusters naming 'dev'
`# k dev`then, u can use `kubectl` to do anything you want
### screenshot
![usage screenshot](https://github.com/lfbear/k/blob/main/cmd.jpg?raw=true)
## Changelog
- 2021.07.02 Add CurrentContext to the bash PS1 (issue #1)
## Extension
### How to use contenxts in kube config file
https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/