<p>I would like to create a helm chart for PostgreSQL with PVC (persistent volume claim).</p>
<p>I've looked at trying katacoda <a href="https://www.katacoda.com/courses/kubernetes/helm-package-manager" rel="noreferrer">https://www.katacoda.com/courses/kubernetes/helm-package-manager</a>
Create Postgres helm chart with pvc.</p>
<p>How might I do this?</p>

<p>I deployed using following <code>PVC</code> ,<code>values.yaml</code> and Chart.yaml</p>

<p>pvc.yaml</p>

<pre><code>kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: postgres-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 25Gi
</code></pre>

<p>values.yaml</p>

<pre><code>postgresql:
  cpu: 1000m
  memory: 1Gi
  persistence:
    enabled: true
    existingClaim: postgres-pvc
  volumePermissions:
    enabled: true
  replication:
    enabled: false
  initdbScripts:
    psql.sql: |
      CREATE USER user WITH PASSWORD 'pass';
      ALTER USER user WITH SUPERUSER;
</code></pre>

<p>Chart.yaml</p>

<pre><code>apiVersion: v2
name: pgname
description: A Short description

type: application

version: 0.1.3

appVersion: 1.16.2

dependencies:
  - name: postgresql
    version: 7.x.x
    repository: https://kubernetes-charts.storage.googleapis.com/
    condition: postgresql.enabled
    tags:
      - services
      - db
      - write
</code></pre>

<p>I have got above files in following directory structure.</p>

<pre><code>.
├── Chart.yaml
├── charts
│   └── postgresql-7.7.3.tgz
└── values.yaml
</code></pre>

<p>At <code>.</code> I do <code>helm dependency update</code> and <code>helm install release_name .</code> to install. Before that <code>kubectl apply -f pvc.yaml</code></p>

<p><strong><em>Note</em></strong> You Need to in in same namespace</p>
