[英]In K8S, how to use data from existed secret when creating new secret?
We got an existed secret in K8S(suppose it is "secret_1") and we want to write a yaml to create a new secret "secret_2", using some values from secret_1. 我们在K8S中获得了一个秘密(假设它是“ secret_1”),我们想使用secret_1中的一些值编写一个Yaml来创建一个新的秘密“ secret_2”。
That is, in this yaml we'd like to 也就是说,在这个Yaml中,我们想
Is it possible to do this? 是否有可能做到这一点? It will be great help if a sample can be provided.
如果可以提供样品,将对您有很大的帮助。
Thanks in advance. 提前致谢。
You cannot do this directly in YAML. 您不能直接在YAML中执行此操作。 You would need to write a script of some kind to do the steps you described, though you can use
kubectl get secret -o yaml
(or -o json
) for a lot of the heavy lifting, possibly with jq
for the reformatting. 尽管可以使用
kubectl get secret -o yaml
(或-o json
)进行繁重的工作,但可能需要使用jq
进行重新格式化,但是您需要编写某种脚本来执行所描述的步骤。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.