kubeswitch

command module
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

Kubeswitch

Kubernetes context and namespace switching with style. Inspired by Kubie with additional features that Kubie lacks.

Prerequisites

  • go 1.14+
  • make

Installation

Download

You can download Kubeswitch from releases page.

MacOS

$ brew install ckt114/tap/kubeswitch

Build

You can build Kubeswitch by running the following commands.

$ git clone https://github.com/ckt114/kubeswitch
$ cd kubeswitch
$ make
$ sudo make install

Default Configuration

Install default configuation to as $HOME/.kubeswitch.yaml.

$ make install-config

Shell Completion

Bash
$ make bash-completion
ZSH
$ make zsh-completion
Fish
$ make fish-completion

Usage

Without Shell Completion

# Switching context. Use context or ctx commands.
$ kubeswitch ctx [ENTER]
? Select context. / to search:
    aws-east1
    aws-west1
    k3s
  ▸ kind

# Switching namespace. Use namespace or ns commands.
(kind|default) $ kubeswitch ns [ENTER]
? Select namespace. / to search:
    argocd
    default
  ▸ jenkins
    kube-node-lease
    kube-public
    kube-system
(kind|jenkins) $

With Shell Completion

# Switching context. Use context or ctx commands.
$ kubeswitch ctx [TAB]
aws-east1  aws-west1   k3s  kind

# Switching namespace. Use namespace or ns commands.
(kind|default) $ kubeswitch ns [TAB]
argocd  default  jenkins  kube-node-lease  kube-public  kube-system

Configuration

Kubeswitch default config file is $HOME/.kubeswitch.yaml. Use -c or --config flags or KUBESWITCH_CONFIG environment variable to override default config file. The following keys are used by Kubeswitch

  • kubeConfig - Kubernetes config file to merge into Kubeswitch session file KUBESWITCH_KUBECONFIG
  • configs - Array list of path patterns to search for Kubernetes config files
  • promptSize - Number of items to show for selection promptKUBESWITCH_PROMPTSIZE
  • noPrompt - Don't use selection prompt; print each item per lineKUBESWITCH_NOPROMPT
  • purge
    • days - Number of days to retain Kubeswitch session filesKUBESWITCH_PURGE_DAYS

Shell Prompt

Using shell prompt integration will greatly help knowing which Kubernetes context and namespace you're currently interacting with.

Bash and ZSH

Fish

Documentation

Overview

Copyright © 2020 Chung Tran <chung.k.tran@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL