All Projects → thecasualcoder → kube-tmuxp

thecasualcoder / kube-tmuxp

Licence: other
Tool to generate tmuxp configs that help to switch between multiple Kubernetes contexts safely.

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to kube-tmuxp

tmuxp-config
Configs for tmuxp (https://github.com/tony/tmuxp)
Stars: ✭ 24 (+14.29%)
Mutual labels:  tmux, tmuxp
kubernetes-elastic-agents
Kubernetes Elastic agent plugin for GoCD
Stars: ✭ 35 (+66.67%)
Mutual labels:  gke
dotfiles-local
Personal configuration
Stars: ✭ 16 (-23.81%)
Mutual labels:  tmux
kubernetes-vault
Run Hashicorp Vault on top of Kubernetes (GKE). Includes instructions for automated backups (GCS) and day-to-day usage.
Stars: ✭ 15 (-28.57%)
Mutual labels:  gke
terraform-gke
A set of terraform modules for building GKE clusters.
Stars: ✭ 17 (-19.05%)
Mutual labels:  gke
dotfiles
NeoVim + git + zsh + tmux bliss
Stars: ✭ 19 (-9.52%)
Mutual labels:  tmux
gke-istio-gce-demo
In this project, you will leverage Kubernetes Engine and Google Compute Engine to explore how Istio can manage services that reside outside of the Kubernetes Engine environment. You will deploy a typical Istio service mesh in Kubernetes Engine, then configure an externally deployed microservice to join the mesh.
Stars: ✭ 53 (+152.38%)
Mutual labels:  gke
gtoken
Securely access AWS services from GKE cluster
Stars: ✭ 43 (+104.76%)
Mutual labels:  gke
google-managed-certs-gke
DEPRECATED: How to use Google Managed SSL Certificates on GKE
Stars: ✭ 16 (-23.81%)
Mutual labels:  gke
.config
Rafi's workstations (Archlinux, osx) ~/.config.
Stars: ✭ 71 (+238.1%)
Mutual labels:  tmux
dotfiles
An elegant way to manage dotfiles, commands, completions, configurations for terminal players.
Stars: ✭ 27 (+28.57%)
Mutual labels:  tmux
croc-hunter-jenkinsx
Croc Hunter demo, deployed with Jenkins X
Stars: ✭ 19 (-9.52%)
Mutual labels:  gke
scheduled-scaler
No description or website provided.
Stars: ✭ 68 (+223.81%)
Mutual labels:  gke
dotfiles
My configuration files
Stars: ✭ 24 (+14.29%)
Mutual labels:  tmux
Dot-It-Up
A collection of dotfile scripts, plugins, and clever hacks so that you can become the master of your own OS! 🚀
Stars: ✭ 254 (+1109.52%)
Mutual labels:  tmux
mdrip
turns markdown into tested tutorials
Stars: ✭ 30 (+42.86%)
Mutual labels:  tmux
kali-config
Linux colorful dotfiles.
Stars: ✭ 40 (+90.48%)
Mutual labels:  tmux
onestatus
an api to customize tmux from vim
Stars: ✭ 82 (+290.48%)
Mutual labels:  tmux
dotfiles
my personal dotfiles mac
Stars: ✭ 39 (+85.71%)
Mutual labels:  tmux
tmuxjump.vim
A plugin to open file from file paths printed in sibling tmux pane
Stars: ✭ 50 (+138.1%)
Mutual labels:  tmux

kube-tmuxp

Build Status

Tool to generate tmuxp configs that help to switch between multiple Kubernetes contexts safely.

Introduction

When working with multiple Kubernetes clusters its painful to switch context using kubectl or kubectx. There are also possibilities of making unintentional changes.

kube-tmuxp solves this by using one preconfigured tmux session per Kubernetes cluster. Each tmux session contains only one Kubernetes context thus preventing accidental context switching inside a session. Contexts can be switched by switching tmux sessions. For example: [tmux prefix] + S.

Given a config similar to config.sample.yaml, kube-tmuxp generates:

  • kube config (Kubernetes context) for each Kubernetes cluster under ~/.kube/configs
  • tmuxp config for each Kubernetes cluster under ~/.tmuxp

The generated tmuxp configs can be used to start preconfigured tmux sessions.

Prerequisites

Install

Homebrew

brew tap thecasualcoder/stable
brew install kube-tmuxp

Manual

git clone https://github.com/thecasualcoder/kube-tmuxp.git
cd kube-tmuxp
make build
cp ./out/kube-tmuxp /usr/local/bin/kube-tmuxp

Generate kubeconfigs and tmuxp configs

  • Copy the sample config (config.sample.yaml)

    cp config.sample.yaml ~/.kube-tmuxp.yaml
    
  • Add your projects and clusters to the copied config

  • Generate kubeconfigs and tmuxp configs

kube-tmuxp gen

Default config path is $HOME/.kube-tmuxp.yaml. If you are using a different path, then use the --config flag to specify that path. Refer kube-tmuxp --help for more details.

Generate kube-tmuxp config file for gcloud

$ kube-tmuxp gcloud-generate --help
Generates configs for kube-tmuxp based on gcloud account

Usage:
  kube-tmuxp gcloud-generate [flags]

Flags:
      --additional-envs strings   Additional envs to be populated
      --all-projects              Skip confirmation for projects
      --apply                    Directly create the tmuxp configs for selected projects
  -h, --help                     help for gcloud-generate
      --project-ids strings       Comma separated Project IDs to which the configurations need to be fetched

Examples:

  1. Interactively select projects:
$ kube-tmuxp gcloud-generate
# this will prompt for the projectIDs selection. Type to filter and select using space
# fuzzy search will work
  1. Specify projectIDs:
$ kube-tmuxp gcloud-generate --projectIDs project1,project2
  1. For all projects:
$ kube-tmuxp gcloud-generate --allProjects
  1. Use env variables in kube-tmuxp:

kube-tmuxp provides four envs: KUBETMUXP_CLUSTER_NAME, KUBETMUXP_CLUSTER_LOCATION, KUBETMUXP_CLUSTER_IS_REGIONAL, GCP_PROJECT_ID. We can pass additional envs also.

$ kube-tmuxp gcloud-generate --additionalEnvs 'NEW_KEY=new_value,NEW_ENV=$HOME,KUBE_CONFIG=$HOME/.kube/configs/$KUBETMUXP_CLUSTER_NAME'
# each tmux session will have 7 envs (4 predefined, 3 additionalEnvs passed as argument)
  1. Directly create the kubeconfigs and tmuxp files (instead of kube-tmuxp config files):
$ kube-tmuxp gcloud-generate --apply

Start a session

tmuxp load my-context-name

Now you will be inside a tmux session preconfigured with Kubernetes context my-context-name.

Handy bash functions

Use the bash functions available here to switch, kill sessions easily. Special thanks to @jskswamy for writing these awesome functions.

Limitations

  • Currently works for Google Kubernetes Engine (GKE) only. However, it can be extended to work with any Kubernetes clusters. Feel free to submit a PR for this.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].