<p>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.</p>

<p>That is, in this yaml we'd like to </p>

<ol>
<li>Read values from other secret</li>
<li>Store values to new secret</li>
</ol>

<p>Is it possible to do this? It will be great help if a sample can be provided.</p>

<p>Thanks in advance.</p>

Lijing Zhang
<p>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 <code>kubectl get secret -o yaml</code> (or <code>-o json</code>) for a lot of the heavy lifting, possibly with <code>jq</code> for the reformatting.</p>
