Code Monkey home page Code Monkey logo

kswp's Introduction

kswp

One way to manage the access to multiple Kubernetes clusters

Motivation

Managing kubeconfigs for multiple Kubernetes clusters can quickly become confusing. While kubeconfig was designed to configure access to multiple clusters with multiple contexts, if you're anything like me you quickly loose track of what cluster you're actually working on and will make mistakes.

This lead to me maintaining multiple kubeconfig files and moving them manually. Obviously this lead to more accidents. This is why I developed kswp. With kswp you provide a list workspaces, each with their own separate kubeconfig, and you can quickly switch between them.

This is essentially the same work flow of maintaining a separate config file for each environment, but the more automated switching lead to less errors in my case.

Usage

First you will need to provide a configuration file. The configuration file needs to be called kswp.yml and needs to either be located at ~/.kube or ~/.config/kswp. It contains the list of environment you need and the location of their config file

configs:
  - name: production
    path: /home/bob/.kube/gke.yaml
  - name: staging
    path: /home/bob/.kube/stage.yml
  - name: local
    path: /home/bob/.kube/microk8s.config

With that in place you can switch to the staging environment with

kswp staging 

This will overwrite your ~/.kube/config

Installation

To install this you can simply run

go get -u github.com/glorfischi/kswp/cmd/kswp

Autocomplete

kswp supports auto-completion. Follow the instructions for your shell to enable it

Bash

$ source <(kswp completion bash)

# To load completions for each session, execute once:
# Linux:
$ kswp completion bash > /etc/bash_completion.d/kswp
# macOS:
$ kswp completion bash > /usr/local/etc/bash_completion.d/kswp

Zsh

# If shell completion is not already enabled in your environment,
# you will need to enable it.  You can execute the following once:

$ echo "autoload -U compinit; compinit" >> ~/.zshrc

# To load completions for each session, execute once:
$ kswp completion zsh > "${fpath[1]}/_kswp"

# You will need to start a new shell for this setup to take effect.

fish:

$ kswp completion fish | source

# To load completions for each session, execute once:
$ kswp completion fish > ~/.config/fish/completions/kswp.fish

kswp's People

Watchers

Fabian Fischer avatar

kswp'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.