ktx
English | 简体中文
ktx is an easy-to-use command line tool for kubernetes multi-cluster context management.
Installation
go install -u github.com/poneding/ktx@latest
For MacOS or Linux:
curl -sSL https://github.com/poneding/ktx/raw/master/install.sh | sh
For Windows:
Download the lastest executable from Releases and add it to the PATH.
Usage
- Add cluster context
ktx add -f .kube/kind-cluster-01
ktx add -f .kube/kind-cluster-02
- List cluster contexts
ktx list
Alias: ktx ls
- Switch cluster context
# Switch to specified cluster context
ktx switch kind-cluster-01
# Interactive switch
ktx switch
Alias: ktx s
- Rename cluster context
# Rename specified cluster context
ktx rename kind-cluster-01
# Interactive rename
ktx rename
- Remove cluster context
# Remove specified cluster context
ktx remove kind-cluster-01
# Interactive remove
ktx remove
Alias: ktx rm
- Export cluster context
ktx export kind-cluster-01 -f .kube/export-01
- Generate kubeconfig from ServiceAccount
ktx generate --service-account default -f .kube/my-gen-config
Alias: ktx gen