<p>I have been trying to create a POD with HELM UPGRADE:</p>
<pre><code>helm upgrade --values=$(System.DefaultWorkingDirectory)/_NAME-deploy-CI/drop/values-NAME.yaml --namespace sda-NAME-pro --install --reset-values --debug --wait NAME .
</code></pre>
<p>but running into below error:</p>
<pre><code>2020-07-08T12:51:28.0678161Z upgrade.go:367: [debug] warning: Upgrade &quot;NAME&quot; failed: failed to create resource: Deployment.apps &quot;NAME&quot; is invalid: [spec.template.spec.volumes[1].secret.secretName: Required value, spec.template.spec.containers[0].volumeMounts[2].name: Not found: &quot;secretvol&quot;]

2020-07-08T12:51:28.0899772Z Error: UPGRADE FAILED: failed to create resource: Deployment.apps &quot;NAME&quot; is invalid: [spec.template.spec.volumes[1].secret.secretName: Required value, spec.template.spec.containers[0].volumeMounts[2].name: Not found: &quot;secretvol&quot;]

</code></pre>
<p>YML part</p>
<pre><code>          volumeMounts:
            - name: secretvol
              mountPath: &quot;/etc/secret-vol&quot;
              readOnly: true                     
      volumes:  
        - name: jks
          secret:
            secretName: {{ .Values.secret.jks }}
        - name: secretvol
          secret:
            secretName: {{ .Values.secret.secretvol }}
</code></pre>
<p>Maybe, the first deploy need another command the first time? how can I specify these value to test it?</p>

RCat
<p><strong>TL;DR</strong></p>
<p>The issue you've encountered:</p>
<pre class="lang-sh prettyprint-override"><code>2020-07-08T12:51:28.0899772Z Error: UPGRADE FAILED: failed to create resource: Deployment.apps &quot;NAME&quot; is invalid: [spec.template.spec.volumes[1].secret.secretName: Required value, spec.template.spec.containers[0].volumeMounts[2].name: Not found: &quot;secretvol&quot;]
</code></pre>
<p>is connected with the fact that the variable: <code>{{ .Values.secret.secretvol }}</code> is <strong>missing</strong>.</p>
<p>To fix it you will need to set this value in either:</p>
<ul>
<li>Helm command that you are using</li>
<li>File that stores your values in the Helm's chart.</li>
</ul>
<blockquote>
<h2>A tip!</h2>
<p>You can run your Helm command with <code>--debug --dry-run</code> to output generated <code>YAML</code>'s. This should show you where the errors could be located.</p>
</blockquote>
<p>There is an official documentation about values in Helm. Please take a look here:</p>
<ul>
<li><em><a href="https://helm.sh/docs/chart_template_guide/values_files/" rel="nofollow noreferrer">Helm.sh: Docs: Chart template guid: Values files</a></em></li>
</ul>
<hr />
<p>Basing on</p>
<blockquote>
<p>I have been trying to create a POD with HELM UPGRADE:</p>
</blockquote>
<p>I've made an example basing on your issue and how you can fix it.</p>
<p>Steps:</p>
<ul>
<li>Create a helm chart with correct values</li>
<li>Edit the values to reproduce the error</li>
</ul>
<h2>Create a helm chart</h2>
<p>For the simplicity of the setup I created basic Helm chart.</p>
<p>Below is the structure of files and directories:</p>
<pre class="lang-sh prettyprint-override"><code>❯ tree helm-dir
helm-dir
├── Chart.yaml
├── templates
│   └── pod.yaml
└── values.yaml

1 directory, 3 files
</code></pre>
<h3>Create <code>Chart.yaml</code> file</h3>
<p>Below is the <code>Chart.yaml</code> file:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v2
name: helm-pod
description: A Helm chart for spawning pod with volumeMount
version: 0.1.0
</code></pre>
<h3>Create a <code>values.yaml</code> file</h3>
<p>Below is the simple <code>values.yaml</code> file which will be used by <strong>default</strong> in the <code>$ helm install</code> command</p>
<pre class="lang-yaml prettyprint-override"><code>usedImage: ubuntu
confidentialName: secret-password # name of the secret in Kubernetes
</code></pre>
<h3>Create a template for a <code>pod</code></h3>
<p>This template is stored in <code>templates</code> directory with a name <code>pod.yaml</code></p>
<p>Below <code>YAML</code> definition will be a template for spawned pod:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  name:  {{ .Values.usedImage }} # value from &quot;values.yaml&quot;
  labels:
    app:  {{ .Values.usedImage }} # value from &quot;values.yaml&quot;
spec:
  restartPolicy: Never
  containers:
  - name: {{ .Values.usedImage }} # value from &quot;values.yaml&quot; 
    image: {{ .Values.usedImage }}  # value from &quot;values.yaml&quot; 
    imagePullPolicy: Always
    command: 
    - sleep 
    - infinity
    volumeMounts:
      - name: secretvol # same name as in spec.volumes.name
        mountPath: &quot;/etc/secret-vol&quot;
        readOnly: true       
  volumes: 
  - name: secretvol # same name as in spec.containers.volumeMounts.name
    secret:
      secretName: {{ .Values.confidentialName }} # value from &quot;values.yaml&quot;
</code></pre>
<p>With above example you should be able to run <code>$ helm install --name test-pod .</code></p>
<p>You should get output similar to this:</p>
<pre class="lang-sh prettyprint-override"><code>NAME:   test-pod
LAST DEPLOYED: Thu Jul  9 14:47:46 2020
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==&gt; v1/Pod
NAME    READY  STATUS             RESTARTS  AGE
ubuntu  0/1    ContainerCreating  0         0s
</code></pre>
<blockquote>
<p>Disclaimer!
The ubuntu pod is in the <code>ContainerCreating</code> state as there is no <a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="nofollow noreferrer">secret</a> named <code>secret-password</code> in the cluster.</p>
</blockquote>
<p>You can get more information about your pods by running:</p>
<ul>
<li><code>$ kubectl describe pod POD_NAME</code></li>
</ul>
<h2>Edit the values to reproduce the error</h2>
<p>The error you got as described earlier is most probably connected with the fact that the value: <code>{{ .Values.secret.secretvol }}</code> was <strong>missing</strong>.</p>
<p>If you were to edit the <code>values.yaml</code> file to:</p>
<pre class="lang-yaml prettyprint-override"><code>usedImage: ubuntu
# confidentialName: secret-password # name of the secret in Kubernetes
</code></pre>
<p><strong>Notice the added <code>#</code></strong>.</p>
<p>You should get below error when trying to deploy this chart:</p>
<pre class="lang-sh prettyprint-override"><code>Error: release test-pod failed: Pod &quot;ubuntu&quot; is invalid: [spec.volumes[0].secret.secretName: Required value, spec.containers[0].volumeMounts[0].name: Not found: &quot;secretvol&quot;]
</code></pre>
<p>I previously mentioned the <code>--debug --dry-run</code> parameters for Helm.</p>
<p>If you run:</p>
<ul>
<li><code>$ helm install --name test-pod --debug --dry-run .</code></li>
</ul>
<p>You should get the output similar to this (this is only the part):</p>
<pre class="lang-yaml prettyprint-override"><code>---
# Source: helm-pod/templates/pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name:  ubuntu # value from &quot;values.yaml&quot;
  labels:
    app:  ubuntu # value from &quot;values.yaml&quot;
spec:
  restartPolicy: Never
  containers:
  - name: ubuntu # value from &quot;values.yaml&quot; 
    image: ubuntu  # value from &quot;values.yaml&quot; 
    imagePullPolicy: Always
    command: 
    - sleep 
    - infinity
    volumeMounts:
      - name: secretvol # same name as in spec.volumes.name
        mountPath: &quot;/etc/secret-vol&quot;
        readOnly: true       
  volumes: 
  - name: secretvol # same name as in spec.containers.volumeMounts.name
    secret:
      secretName:  # value from &quot;values.yaml&quot;
</code></pre>
<p>As you can see the value of <code>secretName</code> was missing. That's the reason above error was showing up.</p>
<pre class="lang-yaml prettyprint-override"><code>      secretName:  # value from &quot;values.yaml&quot;
</code></pre>
