<p>My goal is to write a simple init pod to echo something into a file using a redirect (<code>&gt;</code>) for testing purposes but instead, printing the redirect and file name.  Here's the relevant part of my yaml:</p>

<pre><code>  initContainers:
  - name: cat-to-file
    image: alpine
    args: [ "echo", "Hello, World", "&gt;", "test"]
    workingDir: /project
    volumeMounts:
    - name: project-files
      mountPath: /project
</code></pre>

<p>But, the file doesn't get created and when I view the container logs via:</p>

<pre><code>kubectl logs &lt;pod id&gt; cat-to-file
</code></pre>

<p>It shows me:</p>

<pre><code>Hello, World, &gt; test
</code></pre>

<p>Which makes me think it's echoing the <code>&gt; test</code> to stdout rather than to a file named <code>test</code>.</p>

<p>What am I doing wrong here?</p>

<p>try this:</p>

<pre><code>...
args: [ "/bin/sh", "-c", "echo Hello World &gt; test"]
...
</code></pre>

<p>This approach worked for me <a href="https://github.com/radanalyticsio/spark-operator/blob/9b6a08811738e0b10b6c2dd95578fd9a33cbecf0/src/main/java/io/radanalytics/operator/cluster/KubernetesSparkClusterDeployer.java#L230" rel="noreferrer">here</a>.</p>
