apiVersion: v1 kind: PersistentVolumeClaim metadata: name: db namespace: nextcloud spec: accessModes: - ReadWriteMany resources: requests: storage: 16Gi storageClassName: cephfs-hyper --- apiVersion: apps/v1 kind: Deployment metadata: name: db namespace: nextcloud labels: app: db spec: replicas: 1 selector: matchLabels: app: db template: metadata: labels: app: db spec: containers: - name: db image: mariadb:10.5 imagePullPolicy: "IfNotPresent" ports: - name: mysql containerPort: 3306 env: - name: MARIADB_ROOT_PASSWORD valueFrom: secretKeyRef: name: nextcloud-db key: root.pw - name: MARIADB_USER valueFrom: secretKeyRef: name: nextcloud-db key: username optional: false - name: MARIADB_PASSWORD valueFrom: secretKeyRef: name: nextcloud-db key: user.pw optional: false - name: MARIADB_DATABASE value: nextcloud #livenessProbe: # exec: # command: ["sh", "-c", "exec mysqladmin status -uroot -p$MARIADB_ROOT_PASSWORD"] # initialDelaySeconds: 120 # periodSeconds: 10 # timeoutSeconds: 1 # successThreshold: 1 # failureThreshold: 3 #readinessProbe: # exec: # command: ["sh", "-c", "exec mysqladmin status -uroot -p$MARIADB_ROOT_PASSWORD"] # initialDelaySeconds: 30 # periodSeconds: 10 # timeoutSeconds: 1 # successThreshold: 1 # failureThreshold: 3 volumeMounts: - mountPath: /var/lib/mysql name: data volumes: - name: data persistentVolumeClaim: claimName: db readOnly: false --- apiVersion: v1 kind: Service metadata: name: db namespace: nextcloud spec: internalTrafficPolicy: Cluster ipFamilies: - IPv6 ipFamilyPolicy: SingleStack ports: - name: mysql port: 3306 protocol: TCP targetPort: 3306 selector: app: db sessionAffinity: None type: ClusterIP --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: db-backup namespace: nextcloud spec: accessModes: - ReadWriteMany resources: requests: storage: 10Gi storageClassName: cephfs-hyper --- apiVersion: apps/v1 kind: Deployment metadata: name: db-backup namespace: nextcloud labels: app: db-backup spec: replicas: 1 selector: matchLabels: app: db-backup template: metadata: labels: app: db-backup spec: containers: - name: db-backup image: rsprta/mariadb-backup imagePullPolicy: "IfNotPresent" env: - name: CRON_TIMER value: "@daily" - name: MARIADB_HOST value: db - name: MARIADB_PASSWORD valueFrom: secretKeyRef: name: nextcloud-db key: root.pw - name: MARIADB_USER value: root - name: MARIADB_PORT value: "3306" volumeMounts: - mountPath: /backup name: backup volumes: - name: backup persistentVolumeClaim: claimName: db-backup readOnly: false