<p>I have the following Argo Workflow using a Secret from Kubernetes:</p>
<pre><code>args:
      - |
        export TEST_FILENAME=&quot;./test.txt&quot;
        echo &quot;$TEST_DATA&quot; &gt; $TEST_FILENAME
        chmod 400 $TEST_FILENAME
      env:
      - name: TEST_DATA
        valueFrom:
          secretKeyRef:
            name: test_data
            key: testing
</code></pre>
<p>I need to redirect <code>TEST_DATA</code> to a file when I run the Argo Workflow, but the data of <code>TEST_DATA</code> always shows in the argo-ui log. How can I redirect the data to the file without showing the data in the log?</p>

ratzip
<p><code>echo</code> shouldn't be writing <code>$TEST_DATA</code> to logs the way your code is written. So I'm not sure what's going wrong.</p>
<p>However, I think there's an easier way to <a href="https://kubernetes.io/docs/concepts/configuration/secret/#projection-of-secret-keys-to-specific-paths" rel="nofollow noreferrer">write a secret to a file</a>. Add a volume to your Workflow spec, and a volume mount to the <code>container</code> section of the step spec.</p>
<pre class="lang-yaml prettyprint-override"><code>  containers:
  - name: some-pod
    image: some-image
    volumeMounts:
    - name: test-mount
      mountPath: &quot;/some/path/&quot;
      readOnly: true
  volumes:
  - name: test-volume
    secret:
      secretName: test_data
      items:
      - key: testing
        path: test.txt
</code></pre>
