how to create helm chart of postgres with pvc

前端 未结 2 1744
说谎
说谎 2021-01-22 21:09

I would like to create a helm chart for PostgreSQL with PVC (persistent volume claim).

I\'ve looked at trying katacoda https://www.katacoda.com/courses/kubernetes/helm-pa

2条回答
  •  礼貌的吻别
    2021-01-22 22:05

    I deployed using following PVC ,values.yaml and Chart.yaml

    pvc.yaml

    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
      name: postgres-pvc
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 25Gi
    

    values.yaml

    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;
    

    Chart.yaml

    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
    

    I have got above files in following directory structure.

    .
    ├── Chart.yaml
    ├── charts
    │   └── postgresql-7.7.3.tgz
    └── values.yaml
    

    At . I do helm dependency update and helm install release_name . to install. Before that kubectl apply -f pvc.yaml

    Note You Need to in in same namespace

提交回复
热议问题