Merge multiple kubeconfig
Merge multiple kubeconfig
_ _
| | ___ _| |__ ___ ___ _ __ ___
| |/ / | | | '_ \ / _ \/ __| '_ \ _ \
| <| |_| | |_) | __/ (__| | | | | |
|_|\_\\__,_|_.__/ \___|\___|_| |_| |_|
Find more information at: https://github.com/sunny0826/kubecm
Usage:
kubecm [command]
Available Commands:
add Merge configuration file with ./kube/config
delete Delete the specified context from the kubeconfig
get Displays one or many contexts from the kubeconfig file.
help Help about any command
use Sets the current-context in a kubeconfig file
version Prints the kubecm version
Flags:
-h, --help help for kubecm
Use "kubecm [command] --help" for more information about a command.
Homebrew:
brew install sunny0826/tap/kubecm
Download the binary:
# linux x86_64
curl -Lo kubecm.tar.gz https://github.com/sunny0826/kubecm/releases/download/v${VERSION}/kubecm_${VERSION}_Linux_x86_64.tar.gz
# macos
curl -Lo kubecm.tar.gz https://github.com/sunny0826/kubecm/releases/download/v${VERSION}/kubecm_${VERSION}_Darwin_x86_64.tar.gz
tar -zxvf kubecm.tar.gz kubecm
sudo mv kubecm /usr/local/bin/
# Merge example.yaml with ./kube/config.yaml
kubecm add -f example.yaml
# Merge example.yaml and name contexts test with ./kube/config.yaml
kubecm add -f example.yaml -n test
# Overwrite the original kubeconfig file
kubecm add -f example.yaml -c
# List all the contexts in your kubeconfig file
kubecm get
# Describe one context in your kubeconfig file.
kubecm get my-context
# example output
$ kubecm get
+------------+-----------------------+---------------------------+------------------------+
| CURRENT | NAME | CLUSTER | USER |
+============+=======================+===========================+========================+
| * | al_devops | al_devops-0-cluster | al_devops-0-user |
+------------+-----------------------+---------------------------+------------------------+
| | al_prod | al_prod-0-cluster | al_prod-0-user |
+------------+-----------------------+---------------------------+------------------------+
| | al_test | al_test-0-cluster | al_test-0-user |
+------------+-----------------------+---------------------------+------------------------+
# Delete the context
kubecm delete my-context
# Use the context for the test cluster
kubecm use test
Feel free to open issues and pull requests. Any feedback is highly appreciated!