<p>hy folks </p>

<p>i made the yaml files to deploy my application and now i working with helm to deploy it automatically.However although all of my conf files dor kubernetes worked. i've a problem with helm and <code>PVC</code>. 
i ve checked on internet and i dont find where is my mistake :( </p>

<p><strong>pvc-helm.yaml</strong></p>

<pre><code>{{- if .Values.persistence.enabled }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: {{ .Values.persistence.name }}
  namespace: {{ .Values.persistence.namespace }}
  spec:
    accessModes:
    - {{ .Values.persistence.accessModes | quote }}
    resources:
      requests:
        storage: {{ .Values.persistence.size | quote }}
{{- end }}  
</code></pre>

<p><strong>values.yaml</strong></p>

<pre><code>persistence:
  enabled: true
  name: ds-pvc
  namespace: ds-svc
  storageClassName: standard
  storageClass: standard
  accessModes:
    - ReadWriteOnce
  size: 20Mi
</code></pre>

<p>when i run the command <code>helm install cas/ --tls</code> i get the error below </p>

<blockquote>
  <p>Error: release brawny-olm failed: PersistentVolumeClaim "ds-pvc" is
  invalid: [spec.accessModes: Required value: at least 1 access mode is
  required, spec.resources[storage]: Required value]</p>
</blockquote>

<p>Do i've to set as well a <code>PersistentVolume</code> ? </p>

<p>There are two issues in your helm chart:</p>

<p><strong>1.</strong> <code>spec</code> level shouldn't be below <code>metadata</code> level. It has no relations to <code>metadata</code>, so <code>spec</code> is on the same level as <code>metadata</code>.</p>

<p><strong>2.</strong> Value <code>persistence.accessModes</code> should be defined as a string, not as a list.</p>

<p>The correct files are:</p>

<p><strong>pvc-helm.yaml</strong></p>

<pre><code>{{- if .Values.persistence.enabled }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: {{ .Values.persistence.name }}
  namespace: {{ .Values.persistence.namespace }}
spec:
  accessModes:
  - {{ .Values.persistence.accessModes | quote }}
  resources:
    requests:
      storage: {{ .Values.persistence.size | quote }}
{{- end }}
</code></pre>

<p><strong>values.yaml</strong></p>

<pre><code>persistence:
  enabled: true
  name: ds-pvc
  namespace: default
  storageClassName: standard
  storageClass: standard
  accessModes: ReadWriteOnce
  size: 20Mi
</code></pre>
