Git Product home page Git Product logo

kubectl-config-switcher's Introduction

Kubectl Config Switcher (kcs)

A zsh plugin to switch via KUBECONFIG env variable between kubectl config files located in ~/.kube/

image

Description

I have different kubectl config files in my ~/.kube directory and I swtich to them by terminal window for different profile.

kubectl-config-switch (kcs) help you moving between them with fzf. The last used config is always a ENTER away.

Usage

  • Load the plugin with your favourite zsh plugin manager or simply source the kubectl-config-switcher.plugin.zsh file
  • use the kcs command and it will ask which profile to choose with fzf
  • you can do a kcs -l to simply just list the profiles
  • you can do a kcs -L to set it to the last kubeconfig that was chosen previously.

Requirement

  • fzf
  • kubectl
  • some kubernetes config files in ~/.kube named as ~/.kube/config.${PROFILE_NAME}

Powerlevel10k Integration

the KCS_PROFILE env variable is exported so you can show it nicely in your prompt, for example with powerlevel9/10k add this to your configuration :

  typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION='%F{13}${${${:-$KCS_PROFILE}:-$P9K_KUBECONTEXT_CLUSTER}}%f'
  POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='/%F{3}${${:-$P9K_KUBECONTEXT_NAMESPACE}:-default}%f'

it will look like this :

image

kubectl-config-switcher's People

Contributors

chmouel avatar

Watchers

 avatar  avatar

kubectl-config-switcher's Issues

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.