915 B
915 B
本文作者:丁辉
跨Namespace同步Secret和ConfigMap
示例:同步
test
命名空间下的demo-secret
到default
命名空间下
JQ实现
-
准备依赖
jq
-
Centos
yum install jq -y
-
Ubuntu
apt install jq -y
-
-
执行命令
kubectl get secret demo-secret -n test -o json \ | jq 'del(.metadata["namespace","creationTimestamp","resourceVersion","selfLink","uid"])' \ | kubectl apply -n default -f -
SED实现
kubectl get secret demo-secret -n test -o json \
| jq 'del(.metadata["namespace","creationTimestamp","resourceVersion","selfLink","uid"])' \
| kubectl apply -n default -f -
Helm部署Config-Syncer实现自动同步
请查看此文档:Helm部署Config-Syncer