10 个版本
0.1.9 | 2022年1月1日 |
---|---|
0.1.8 | 2022年1月1日 |
在 开发工具 中排名 1436
每月下载量 24
22KB
414 行
rkdump (rust kdump)
将所有 Kubernetes API 资源(Pod、Deployment、Namespace 等)以 YAML 格式导出到文件中。
快速且简单的解决方案。不要期待代码很美观 :).
我的用例:穷人的 etcd -> git 同步
导出所有配置上下文中的 API 资源。
调用 kubectl api-resources 以确定其访问权限,然后开始使用 kubectl get -o yaml > . 下载所有内容。注意:如果明确提供加密密钥(aes gcm),还会导出密钥。
现在用 Rust 编写。
用法
rkdump --help
rkdump 0.1.0
Dump all kubernetes resources as yaml files to a dir
USAGE:
rkdump <SUBCOMMAND>
OPTIONS:
-h, --help Print help information
-V, --version Print version information
SUBCOMMANDS:
download Normal usage. Download all resources
cluster-resource-types List resource types available for download in the cluster
default-excluded-types Don't download resources - instead show default excluded types
rkdump download --help
rkdump-download
Normal usage. Download all resources
USAGE:
rkdump download [OPTIONS] --output-dir <OUTPUT_DIR>
OPTIONS:
-o, --output-dir <OUTPUT_DIR>
REQUIRED: output directory to create
--delete-previous-dir
if to delete previous output directory (default: false)
--secrets-encryption-key <SECRETS_ENCRYPTION_KEY>
symmetric secrets encryption hex key for aes GCM (lower case 64 chars)
--no-default-excluded-types
disable default excluded types
--excluded-types <EXCLUDED_TYPES>
add additional excluded types
-h, --help
Print help information
示例
rkdump download --output-dir test --delete-previous-dir --excluded-types deployments.apps --excluded-
types services
2021-12-30 22:10:36,500 INFO [kdump] Checking what k8s types to download...
2021-12-30 22:10:37,679 INFO [kdump] Downloading all objects...
2021-12-30 22:10:44,863 INFO [kdump] Deserializing yaml...
2021-12-30 22:10:47,302 INFO [kdump] Writing yaml files...
2021-12-30 22:10:47,782 INFO [kdump] DONE!
rkdump cluster-resource-types
Cluster types:
- configmaps
- challenges.acme.cert-manager.io
- orders.acme.cert-manager.io
...
rkdump default-excluded-types
Default excluded types:
- limitranges
- podtemplates
- replicationcontrollers
- resourcequotas
- events
- jobs
...
依赖项
~9MB
~171K SLoC