This message was deleted.
# general
a
This message was deleted.
h
here is a section from my deployment template:
Copy code
volumeMounts:
            - name: gitops-config
              mountPath: /etc/gitlab
            - name: gitops-logs
              mountPath: /var/log/gitlab
            - name: gitops-data
              mountPath: /var/opt/gitlab
            {{- with .Values.gitops.volumeMounts }}
              {{- toYaml . | nindent 12 }}
            {{- end }}
      volumes:
        - name: gitops-config
          persistentVolumeClaim:
            claimName: {{ include "dwms.fullname" . }}-gitops-config
        - name: gitops-logs
          persistentVolumeClaim:
            claimName: {{ include "dwms.fullname" . }}-gitops-logs
        - name: gitops-data
          persistentVolumeClaim:
            claimName: {{ include "dwms.fullname" . }}-gitops-config
        # - name: gitops-config
        #   hostPath:
        #     path: /opt/dwms/gitops-config
        # - name: gitops-logs
        #   hostPath:
        #     path: /opt/dwms/gitops-logs
        # - name: gitops-data
        #   hostPath:
        #     path: /opt/dwms/gitops-data
It works correctly with
hostPath
volumes, but I want to use PV's and PVC's so that I can replace them with a proper storage driver later. Here's the PVC template (the other two are the same except for name and volumeName):
Copy code
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ include "dwms.fullname" . }}-gitops-config
  labels:
    {{- include "dwms.labels" . | nindent 4 }}
spec:
  # storageClassName: manual
  storageClassName: ''
  volumeName: {{ include "dwms.fullname" . }}-gitops-config
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi
And here's the PV which I created from the Rancher UI:
Copy code
apiVersion: v1
kind: PersistentVolume
metadata:
  annotations:
    <http://pv.kubernetes.io/bound-by-controller|pv.kubernetes.io/bound-by-controller>: 'yes'
  creationTimestamp: '2024-04-05T15:55:07Z'
  finalizers:
    - <http://kubernetes.io/pv-protection|kubernetes.io/pv-protection>
  managedFields:
    - apiVersion: v1
      fieldsType: FieldsV1
      fieldsV1:
        f:spec:
          f:accessModes: {}
          f:capacity:
            .: {}
            f:storage: {}
          f:hostPath:
            .: {}
            f:path: {}
            f:type: {}
          f:persistentVolumeReclaimPolicy: {}
          f:volumeMode: {}
      manager: agent
      operation: Update
      time: '2024-04-05T15:55:07Z'
    - apiVersion: v1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:<http://pv.kubernetes.io/bound-by-controller|pv.kubernetes.io/bound-by-controller>: {}
        f:spec:
          f:claimRef:
            .: {}
            f:apiVersion: {}
            f:kind: {}
            f:name: {}
            f:namespace: {}
            f:resourceVersion: {}
            f:uid: {}
      manager: kube-controller-manager
      operation: Update
      time: '2024-04-05T15:55:54Z'
    - apiVersion: v1
      fieldsType: FieldsV1
      fieldsV1:
        f:status:
          f:phase: {}
      manager: kube-controller-manager
      operation: Update
      subresource: status
      time: '2024-04-05T15:55:54Z'
  name: dwms-gitops-config
  resourceVersion: '830165'
  uid: 0060efb3-daf1-4322-8927-96537d5fec09
spec:
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 10Gi
  claimRef:
    apiVersion: v1
    kind: PersistentVolumeClaim
    name: dwms-gitops-config
    namespace: default
    resourceVersion: '830163'
    uid: faf5532d-04c6-469f-bcaf-3ffe944807bb
  hostPath:
    path: /opt/dwms/gitops-config
    type: ''
  persistentVolumeReclaimPolicy: Retain
  volumeMode: Filesystem
status:
  phase: Bound