切换 Kubernetes 命名空间
项目描述
KSNS
Python 中的 Kubernetes CLI 包装器,用于切换和列出命名空间。它不需要 kubectl 即可工作。
由 Ratul (c) 2021 开发
安装
需要 Python 3.6+。
pip3 install ksns
用法
您需要设置KUBECONFIG环境变量或~/.kube/config将被考虑。
ratul ➤ ksns --help
Usage: python -m ksns [OPTIONS] COMMAND [ARGS]...
NOTE: Set the KUBECONFIG environment variable or ~/.kube/config will be
considered
USAGE:
1. list namespaces : ksns list
2. switch namespaces: ksns ns <namespace_name>
Options:
--help Show this message and exit.
Commands:
list List of namespaces in context
ns Switch to another namespace: <namespace_name>
您所在的当前命名空间颜色将yellow在列表命名空间的输出中。
列出命名空间
ratul ➤ ksns list
default
demo
kube-node-lease
kube-public
kube-system
kubernetes-dashboard
monitoring
note: using config: /home/ubuntu/config
切换命名空间
ratul ➤ ksns ns monitoring
switched to monitoring namespace
note: using config: /home/ubuntu/config
局部变化
建议为项目使用 virtualenv。
转到项目目录并安装依赖项
cd <project-path>
pip3 install -r requirements.txt
pip3 install --editable .
项目详情
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ksns-0.0.5.tar.gz
(16.1 kB
view hashes)
Built Distribution
ksns-0.0.5-py3-none-any.whl
(16.7 kB
view hashes)