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.
That is, in this yaml we'd like to
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. 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.