nextcloud / helm

A community maintained helm chart for deploying Nextcloud on Kubernetes.
GNU Affero General Public License v3.0
295 stars 258 forks source link

Config & Data folder empty after using Persistence #504

Open oliverhu opened 6 months ago

oliverhu commented 6 months ago

Describe your Issue

After using persistence storage, both data & config folders are empty. Command used helm install nextcloud-release --set persistence.enabled=true,persistence.storageClass=freenas-nfs-csi,persistence.nextcloudData.enabled=true,persistence.nextcloudData.storageClass=freenas-nfs-csi nextcloud/nextcloud

The persistence storage are successful created and bound. I am able to exec into the pod and read/write in the mount folder.

image

I used freenas-nfs-csi as the PVC class and I tried the following:

  1. disable readiness probe.
  2. disable liveness probe.
  3. only use persistence storage for primary
  4. change access mode to ReadWriteMany

None worked...

Logs and Errors

Stuck at

 Initializing nextcloud 28.0.1.1 ...

Apache2 can't start since the config/ folder is completely empty.

Describe your Environment

kind: Pod
apiVersion: v1
metadata:
  name: nextcloud-release-86757b74db-nr5rv
  generateName: nextcloud-release-86757b74db-
  namespace: default
  uid: b720dc30-f0a3-4da7-9ed9-6e11d8a80b80
  resourceVersion: '25505'
  creationTimestamp: '2024-01-01T05:01:30Z'
  labels:
    app.kubernetes.io/component: app
    app.kubernetes.io/instance: nextcloud-release
    app.kubernetes.io/name: nextcloud
    pod-template-hash: 86757b74db
  annotations:
    nextcloud-config-hash: a5aae02b1b8278a9c8a2dc143e82d3737fc295f62c34afd617207f37d1b2b438
    php-config-hash: 44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
  ownerReferences:
    - apiVersion: apps/v1
      kind: ReplicaSet
      name: nextcloud-release-86757b74db
      uid: eb397820-97e5-4e4e-a63e-03654613766e
      controller: true
      blockOwnerDeletion: true
  managedFields:
    - manager: k3s
      operation: Update
      apiVersion: v1
      time: '2024-01-01T05:01:30Z'
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:nextcloud-config-hash: {}
            f:php-config-hash: {}
          f:generateName: {}
          f:labels:
            .: {}
            f:app.kubernetes.io/component: {}
            f:app.kubernetes.io/instance: {}
            f:app.kubernetes.io/name: {}
            f:pod-template-hash: {}
          f:ownerReferences:
            .: {}
            k:{"uid":"eb397820-97e5-4e4e-a63e-03654613766e"}: {}
        f:spec:
          f:containers:
            k:{"name":"nextcloud"}:
              .: {}
              f:env:
                .: {}
                k:{"name":"NEXTCLOUD_ADMIN_PASSWORD"}:
                  .: {}
                  f:name: {}
                  f:valueFrom:
                    .: {}
                    f:secretKeyRef: {}
                k:{"name":"NEXTCLOUD_ADMIN_USER"}:
                  .: {}
                  f:name: {}
                  f:valueFrom:
                    .: {}
                    f:secretKeyRef: {}
                k:{"name":"NEXTCLOUD_DATA_DIR"}:
                  .: {}
                  f:name: {}
                  f:value: {}
                k:{"name":"NEXTCLOUD_TRUSTED_DOMAINS"}:
                  .: {}
                  f:name: {}
                  f:value: {}
                k:{"name":"SQLITE_DATABASE"}:
                  .: {}
                  f:name: {}
                  f:value: {}
              f:image: {}
              f:imagePullPolicy: {}
              f:name: {}
              f:ports:
                .: {}
                k:{"containerPort":80,"protocol":"TCP"}:
                  .: {}
                  f:containerPort: {}
                  f:name: {}
                  f:protocol: {}
              f:resources: {}
              f:terminationMessagePath: {}
              f:terminationMessagePolicy: {}
              f:volumeMounts:
                .: {}
                k:{"mountPath":"/var/www/"}:
                  .: {}
                  f:mountPath: {}
                  f:name: {}
                  f:subPath: {}
                k:{"mountPath":"/var/www/html"}:
                  .: {}
                  f:mountPath: {}
                  f:name: {}
                  f:subPath: {}
                k:{"mountPath":"/var/www/html/config"}:
                  .: {}
                  f:mountPath: {}
                  f:name: {}
                  f:subPath: {}
                k:{"mountPath":"/var/www/html/custom_apps"}:
                  .: {}
                  f:mountPath: {}
                  f:name: {}
                  f:subPath: {}
                k:{"mountPath":"/var/www/html/data"}:
                  .: {}
                  f:mountPath: {}
                  f:name: {}
                  f:subPath: {}
                k:{"mountPath":"/var/www/html/themes"}:
                  .: {}
                  f:mountPath: {}
                  f:name: {}
                  f:subPath: {}
                k:{"mountPath":"/var/www/tmp"}:
                  .: {}
                  f:mountPath: {}
                  f:name: {}
                  f:subPath: {}
          f:dnsPolicy: {}
          f:enableServiceLinks: {}
          f:restartPolicy: {}
          f:schedulerName: {}
          f:securityContext:
            .: {}
            f:fsGroup: {}
          f:terminationGracePeriodSeconds: {}
          f:volumes:
            .: {}
            k:{"name":"nextcloud-data"}:
              .: {}
              f:name: {}
              f:persistentVolumeClaim:
                .: {}
                f:claimName: {}
            k:{"name":"nextcloud-main"}:
              .: {}
              f:name: {}
              f:persistentVolumeClaim:
                .: {}
                f:claimName: {}
    - manager: k3s
      operation: Update
      apiVersion: v1
      time: '2024-01-01T05:01:51Z'
      fieldsType: FieldsV1
      fieldsV1:
        f:status:
          f:conditions:
            .: {}
            k:{"type":"ContainersReady"}:
              .: {}
              f:lastProbeTime: {}
              f:lastTransitionTime: {}
              f:status: {}
              f:type: {}
            k:{"type":"Initialized"}:
              .: {}
              f:lastProbeTime: {}
              f:lastTransitionTime: {}
              f:status: {}
              f:type: {}
            k:{"type":"PodScheduled"}:
              .: {}
              f:lastProbeTime: {}
              f:lastTransitionTime: {}
              f:message: {}
              f:reason: {}
              f:status: {}
              f:type: {}
            k:{"type":"Ready"}:
              .: {}
              f:lastProbeTime: {}
              f:lastTransitionTime: {}
              f:status: {}
              f:type: {}
          f:containerStatuses: {}
          f:hostIP: {}
          f:phase: {}
          f:podIP: {}
          f:podIPs:
            .: {}
            k:{"ip":"10.42.0.38"}:
              .: {}
              f:ip: {}
          f:startTime: {}
      subresource: status
spec:
  volumes:
    - name: nextcloud-main
      persistentVolumeClaim:
        claimName: nextcloud-release-nextcloud
    - name: nextcloud-data
      persistentVolumeClaim:
        claimName: nextcloud-release-nextcloud-data
    - name: kube-api-access-hwbqv
      projected:
        sources:
          - serviceAccountToken:
              expirationSeconds: 3607
              path: token
          - configMap:
              name: kube-root-ca.crt
              items:
                - key: ca.crt
                  path: ca.crt
          - downwardAPI:
              items:
                - path: namespace
                  fieldRef:
                    apiVersion: v1
                    fieldPath: metadata.namespace
        defaultMode: 420
  containers:
    - name: nextcloud
      image: nextcloud:28.0.1-apache
      ports:
        - name: http
          containerPort: 80
          protocol: TCP
      env:
        - name: SQLITE_DATABASE
          value: nextcloud
        - name: NEXTCLOUD_ADMIN_USER
          valueFrom:
            secretKeyRef:
              name: nextcloud-release
              key: nextcloud-username
        - name: NEXTCLOUD_ADMIN_PASSWORD
          valueFrom:
            secretKeyRef:
              name: nextcloud-release
              key: nextcloud-password
        - name: NEXTCLOUD_TRUSTED_DOMAINS
          value: octopusai.cloud
        - name: NEXTCLOUD_DATA_DIR
          value: /var/www/html/data
      resources: {}
      volumeMounts:
        - name: nextcloud-main
          mountPath: /var/www/
          subPath: root
        - name: nextcloud-main
          mountPath: /var/www/html
          subPath: html
        - name: nextcloud-data
          mountPath: /var/www/html/data
          subPath: data
        - name: nextcloud-main
          mountPath: /var/www/html/config
          subPath: config
        - name: nextcloud-main
          mountPath: /var/www/html/custom_apps
          subPath: custom_apps
        - name: nextcloud-main
          mountPath: /var/www/tmp
          subPath: tmp
        - name: nextcloud-main
          mountPath: /var/www/html/themes
          subPath: themes
        - name: kube-api-access-hwbqv
          readOnly: true
          mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
      imagePullPolicy: IfNotPresent
  restartPolicy: Always
  terminationGracePeriodSeconds: 30
  dnsPolicy: ClusterFirst
  serviceAccountName: default
  serviceAccount: default
  nodeName: pig
  securityContext:
    fsGroup: 33
  schedulerName: default-scheduler
  tolerations:
    - key: node.kubernetes.io/not-ready
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
    - key: node.kubernetes.io/unreachable
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
  priority: 0
  enableServiceLinks: true
  preemptionPolicy: PreemptLowerPriority
status:
  phase: Running
  conditions:
    - type: Initialized
      status: 'True'
      lastProbeTime: null
      lastTransitionTime: '2024-01-01T05:01:43Z'
    - type: Ready
      status: 'True'
      lastProbeTime: null
      lastTransitionTime: '2024-01-01T05:01:51Z'
    - type: ContainersReady
      status: 'True'
      lastProbeTime: null
      lastTransitionTime: '2024-01-01T05:01:51Z'
    - type: PodScheduled
      status: 'True'
      lastProbeTime: null
      lastTransitionTime: '2024-01-01T05:01:43Z'
  hostIP: 192.168.4.107
  podIP: 10.42.0.38
  podIPs:
    - ip: 10.42.0.38
  startTime: '2024-01-01T05:01:43Z'
  containerStatuses:
    - name: nextcloud
      state:
        running:
          startedAt: '2024-01-01T05:01:50Z'
      lastState: {}
      ready: true
      restartCount: 0
      image: docker.io/library/nextcloud:28.0.1-apache
      imageID: >-
        docker.io/library/nextcloud@sha256:9527f6fa13242f7a104c64e21dfab3a0f396c579d3ec62e574996178670d50b4
      containerID: >-
        containerd://89c1e0ba0234dd26a467eb52db28f73c2a6bbe6768fba1d001e8b3b160c32169
      started: true
  qosClass: BestEffort
oliverhu commented 6 months ago

Even if the uid:gid are not correct, the persmissions are 777 for those folders. not sure why config files can't be written there.

jessebot commented 2 months ago

Could you please post the values.yaml you used for installing this chart? It looks like you posted your pod manifest, but we need the parameters for this helm chart to best help you. Thank you!