Git Product home page Git Product logo

k's Introduction

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

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/

k's People

Contributors

lfbear avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

k's Issues

Add CurrentContext to the bash PS1

as the title said. so we know which cluster we are connecting now.

How to do it

  1. kubectl config current-context
  2. set to an new env
  3. update $PS1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.