title: kubernetes: mounting volume from within init container
body: <p>I'm trying to make use of init container to prepare some files before the main container starts up. In the init container I'd like to mount a <code>hostPath</code> volume so that I can share prepare some file for the main container.</p>
  
  <p>My cluster is using pre 1.6 version of kubernetes so I'm using the <code>meta.annotation</code> syntax:</p>
  
  <pre><code>pod.beta.kubernetes.io/init-containers: '[
      {
          "name": "init-myservice",
          "image": "busybox",
          "command": ["sh", "-c", "mkdir /tmp/jack/ &amp;&amp; touch cd /tmp/jack &amp;&amp; touch a b c"],
          "volumeMounts": [{
            "mountPath": "/tmp/jack",
            "name": "confdir"
          }]
      }
  ]'
  </code></pre>
  
  <p>But it doesn't seem to work. The addition of <code>volumeMounts</code> cause the container <code>init-myserver</code> go into CrashLoop. Without it the pod gets created successfully but it doesn't achieve what I want.</p>
  
  <p>Is it not possible in &lt;1.5 to mount volume in init container?
  What about 1.6+?</p>