Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imyuliz/kubectl-switch
Kubernetes multi-cluster command-line management tool
https://github.com/imyuliz/kubectl-switch
kubectl kubectl-plugin kubectl-plugins kubernetes
Last synced: 7 days ago
JSON representation
Kubernetes multi-cluster command-line management tool
- Host: GitHub
- URL: https://github.com/imyuliz/kubectl-switch
- Owner: imyuliz
- License: apache-2.0
- Created: 2019-04-28T11:20:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-12T10:39:58.000Z (over 5 years ago)
- Last Synced: 2024-05-21T12:42:17.125Z (6 months ago)
- Topics: kubectl, kubectl-plugin, kubectl-plugins, kubernetes
- Language: Go
- Homepage:
- Size: 38.2 MB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-kubectl-plugins - kubectl-switch - cluster command-line management tool | Context/Namespace Switching | (kubectl Plugins / Installing plugins via awesome-kubectl-plugins)
README
# kubectl-switch
kubectl-switch是一个kubernetes命令行工具插件,它做的事情非常简单,即:你可以在一台计算机上可以操作多个kubernetes集群.
### 使用快照
这是一个小示例
### 安装⚠️ **警告: `kubectl` 必须在1.12.0及以上**, 你可以使用`kubectl version`命令来查看是否满足前置条件
如果需要安装`kubectl`, 请查看:[Install and Set Up kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
```
➜ ~ kubectl versionGitVersion:"v1.14.1"
```源码编译:
```
go get -u github.com/yulibaozi/kubectl-switchcd $GOPATH/src/github.com/yulibaozi/kubectl-switch
go build .
# move PATH
mv ./kubectl-switch /usr/local/bin/
```Mac :
```
brew tap yulibaozi/tap && brew install kubectl-switch
```Linux:
```
export PLUGIN_VERSION=1.0.1
# linux x86_64
echo "https://github.com/yulibaozi/kubectl-switch/releases/download/v${PLUGIN_VERSION}/kubectl-switch_${PLUGIN_VERSION}_linux_amd64.tar.gz" | xargs curl -o kubectl-switch.tar.gz -Lv# macos
echo "https://github.com/yulibaozi/kubectl-switch/releases/download/v${PLUGIN_VERSION}/kubectl-switch_${PLUGIN_VERSION}_darwin_amd64.tar.gz" | xargs curl -o kubectl-switch.tar.gz -Lvtar -zxvf kubectl-switch.tar.gz kubectl-switch
sudo mv kubectl-switch /usr/local/bin/
```### 使用流程
step 1. 当你安装完`kubectl-switch`后, 需要向`kubectl-switch`注册需要操作的集群
```
kubectl switch register qa /root/yulibaozi/admin.kubeconfig
# 集群名字 集群操作所需要config文件
```2. 查看向`kubectl-switch`注册成功的集群列表
```
kubectl switch list
```3. 查看当前`kubectl`操作的集群
```
kubectl switch where
```
4. 切换`kubectl`操作的集群
```
kubectl switch qa
```
5. 正常执行其他kubectl命令```
两种方式:
如获取节点列表列表:1. kubectl get node
2. kubectl switch qa get node
```### 使用惯例
1. 查看支持哪些命令
```➜ ~ kubectl switch -h
Kubernetes multi-cluster command line management tool.
Usage:
kubectl-switch [flags]
kubectl-switch [command]Available Commands:
help Help about any command
list List all cluster message
where View cluster of currently in use
register Register cluster in switch plugin
remove Remove the specified cluster name
removeall Removeall cluster config
version view switch plugin versionFlags:
-h, --help help for kubectl-switch
-t, --toggle Help message for toggleUse "kubectl-switch [command] --help" for more information about a command.
```