Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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/