fix(nextcloud): Enable persistence to survive pod restarts

Nextcloud requires a persistent /var/www/html to retain installation
state (config.php, version.php, installed apps) across restarts.
Without it, every restart triggers the setup wizard. Uses local-path
2Gi PVC with Recreate strategy since the volume is RWO.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Felix Wolf 2026-04-04 18:42:34 +02:00
parent 0d60c04e2d
commit 72b39586b6
3 changed files with 21 additions and 27 deletions

View file

@ -57,9 +57,6 @@ nextcloud:
opcache.save_comments=1 opcache.save_comments=1
opcache.revalidate_freq=60 opcache.revalidate_freq=60
hooks:
before-starting: touch /var/www/html/config/CAN_INSTALL
extraSidecarContainers: extraSidecarContainers:
- name: caddy - name: caddy
image: caddy:2-alpine image: caddy:2-alpine
@ -124,10 +121,7 @@ nextcloud:
name: nextcloud-caddy-config name: nextcloud-caddy-config
strategy: strategy:
type: RollingUpdate type: Recreate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
internalDatabase: internalDatabase:
enabled: false enabled: false
@ -165,7 +159,11 @@ cronjob:
enabled: true enabled: true
persistence: persistence:
enabled: false enabled: true
size: 2Gi
storageClassName: local-path
annotations:
helm.sh/resource-policy: keep
ingress: ingress:
enabled: true enabled: true

View file

@ -20,14 +20,11 @@ spec:
app.kubernetes.io/instance: nextcloud app.kubernetes.io/instance: nextcloud
app.kubernetes.io/name: nextcloud app.kubernetes.io/name: nextcloud
strategy: strategy:
rollingUpdate: type: Recreate
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template: template:
metadata: metadata:
annotations: annotations:
hooks-hash: 47a89ca9deff73131884ece615e1cabb1f600fec60aa8f20244ae3c5bb58f948 hooks-hash: 9525c2748a6c7cd0e28ec740623d0b3fa5a75c83b51ccfd136bc89c76737b204
nextcloud-config-hash: ec89ea6d9676ed525984771aab8f4536c9f4f62736b2c9898e883f5d0a7f90f8 nextcloud-config-hash: ec89ea6d9676ed525984771aab8f4536c9f4f62736b2c9898e883f5d0a7f90f8
php-config-hash: b638f66fd8d65de8364dbad6efc59a6524c7b2e2377b5623cf5e921e4d3d2400 php-config-hash: b638f66fd8d65de8364dbad6efc59a6524c7b2e2377b5623cf5e921e4d3d2400
labels: labels:
@ -208,10 +205,6 @@ spec:
- mountPath: /usr/local/etc/php/conf.d/uploadLimit.ini - mountPath: /usr/local/etc/php/conf.d/uploadLimit.ini
name: nextcloud-phpconfig name: nextcloud-phpconfig
subPath: uploadLimit.ini subPath: uploadLimit.ini
- mountPath: /docker-entrypoint-hooks.d/before-starting/helm.sh
name: nextcloud-hooks
readOnly: true
subPath: before-starting.sh
- command: - command:
- /cron.sh - /cron.sh
env: env:
@ -412,18 +405,15 @@ spec:
securityContext: securityContext:
fsGroup: 33 fsGroup: 33
volumes: volumes:
- emptyDir: {} - name: nextcloud-main
name: nextcloud-main persistentVolumeClaim:
claimName: nextcloud-nextcloud
- configMap: - configMap:
name: nextcloud-config name: nextcloud-config
name: nextcloud-config name: nextcloud-config
- configMap: - configMap:
name: nextcloud-phpconfig name: nextcloud-phpconfig
name: nextcloud-phpconfig name: nextcloud-phpconfig
- configMap:
defaultMode: 493
name: nextcloud-hooks
name: nextcloud-hooks
- configMap: - configMap:
name: nextcloud-caddy-config name: nextcloud-caddy-config
name: caddy-config name: caddy-config

View file

@ -1,15 +1,21 @@
apiVersion: v1 apiVersion: v1
data: kind: PersistentVolumeClaim
before-starting.sh: touch /var/www/html/config/CAN_INSTALL
kind: ConfigMap
metadata: metadata:
annotations: annotations:
a8r.io/repository: ssh://git@git.tr1ceracop.de:222/gitea_admin/k8s-and-chill.git a8r.io/repository: ssh://git@git.tr1ceracop.de:222/gitea_admin/k8s-and-chill.git
helm.sh/resource-policy: keep
labels: labels:
app.kubernetes.io/component: app
app.kubernetes.io/instance: nextcloud app.kubernetes.io/instance: nextcloud
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: nextcloud app.kubernetes.io/name: nextcloud
app.kubernetes.io/version: 33.0.0 app.kubernetes.io/version: 33.0.0
helm.sh/chart: nextcloud-9.0.4 helm.sh/chart: nextcloud-9.0.4
name: nextcloud-hooks name: nextcloud-nextcloud
namespace: nextcloud namespace: nextcloud
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi