Skip to content

Jeff-Tian/k8ss

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

k8ss

k8s cluster and namespace switcher

Git commit with emojis! Build Status semantic-release

Quality gate

Prerequisites

  • nodejs installed (tested in version 12)
  • kubectl installed
  • k8s-config folder in home directory, for example:
~
 |-- k8s-config
       |-- hangzhou
              |-- config
       |-- beijing
              |-- config

Installation

npm install k8ss --global

Usage

List all configured clusters

k8ss list

Switch to cluster or namespace

# full usage:
k8ss switch --cluster=hangzhou --namespace=test

# switch namespace only without change cluster:
k8ss s --namespace=stage

Login

k8ss login

How

  • move the related config file into ~/.kube
  • execute kubectl config set-context $(kubectl config current-context) --namespace=<namespace>

FAQ

  • npm WARN checkPermissions Missing write access to /usr/local/nvm/versions/node/v12.13.1/lib/node_modules

    Then you can install it locally by npm i k8ss and then run it as ./node_modules/.bin/k8ss switch --namespace=xxx.