<p>This is a follow-up question to my former question on chart validation <a href="https://stackoverflow.com/questions/69994873/how-to-solve-error-yaml-to-json-yaml-line-118-did-not-find-expected-key">here</a>
While trying to deploy a helm chart, I have an error that shows thus:</p>
<pre><code>Error: UPGRADE FAILED: error validating &quot;&quot;: error validating data: ValidationError(Deployment.spec.template.spec.initContainers[1]): unknown field &quot;mountPath&quot; in io.k8s.api.core.v1.Container
make: *** [upgrade] Error 1
</code></pre>
<p>FWIW, this is the <code>initcontainer spec</code> details below:</p>
<pre><code>spec:
      initContainers:
      {{- if .Values.libp2p.staticKeypair.enabled}}
      - name: libp2p-init-my-service
        image: busybox:1.28
        command: ['sh', '-c', '/bin/cp /libp2p-keys/* /root/libp2p-keys &amp;&amp; /bin/chmod -R 0700 /root/libp2p-keys/']
        volumeMounts:
        - mountPath: /libp2p-keys
          name: source-libp2p-keys 
        - mountPath: /root/libp2p-keys
          name: destination-libp2p
      {{- end }}
      - name: config-dir
        mountPath: /root/.mina-config
      - name: fix-perms
        image: busybox:1.28
        command: [ 'sh', '-c', 'for dir in keys echo-keys faucet-keys; do [ -d /$dir ] &amp;&amp; /bin/cp /$dir/* /wallet-keys; done; /bin/chmod 0700 /wallet-keys']
        volumeMounts:
        - mountPath: &quot;/keys/&quot;
          name: private-keys
          readOnly: true
        - mountPath: /wallet-keys
          name: wallet-keys
      containers:
</code></pre>
<p>What could be the possible causes and how can I handle them?</p>

Aro
<p>You're working with YAML so take care about the indentation since it's really important.</p>
<p>Since you're declaring <code>initContainers</code>, on the first level you define <code>Containers</code>; but you included the following on that level:</p>
<pre><code>- name: config-dir
  mountPath: /root/.mina-config
</code></pre>
<p>Since <code>name</code> is actually an attribute of <code>Container</code>, it complains about <code>mountPath</code>.</p>
<p>I don't know where you want to mount <code>.mina-config</code>, but it should be nested inside of the <code>volumeMounts</code> attribute within a <code>Container</code> and not at the same level than the containers.</p>
