apiVersion: apps/v1 kind: Deployment metadata: name: nextcloud labels: app.kubernetes.io/name: nextcloud spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app.kubernetes.io/name: nextcloud template: metadata: labels: app.kubernetes.io/name: nextcloud spec: affinity: nodeAffinity: # prefer to not be on a server node (resource contention) preferredDuringSchedulingIgnoredDuringExecution: - weight: 1 preference: matchExpressions: - key: kubernetes.io/hostname operator: NotIn values: - k3s-s0 containers: - name: nextcloud image: nextcloud env: - name: NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace - name: TRUSTED_PROXIES value: 10.0.0.0/8 - name: REDIS_HOST value: redis.$(NAMESPACE).svc.cluster.local - name: REDIS_HOST_PASSWORD valueFrom: secretKeyRef: name: redis-credentials key: password - name: POSTGRES_HOST value: postgres.$(NAMESPACE).svc.cluster.local - name: POSTGRES_DB valueFrom: secretKeyRef: name: postgres-credentials key: database - name: POSTGRES_USER valueFrom: secretKeyRef: name: postgres-credentials key: username - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: postgres-credentials key: password ports: - name: http containerPort: 80 resources: requests: cpu: 2000m memory: 1Gi limits: cpu: 4000m memory: 1.5Gi volumeMounts: - name: nextcloud-pv mountPath: /var/www/html # - name: nextcloud-cron # image: badjware/nextcloud-tweak # command: ['cron', '-f'] # volumeMounts: # - name: nextcloud-pv # mountPath: /var/www/html # resources: # limits: # cpu: 250m # memory: 250Mi volumes: - name: nextcloud-pv persistentVolumeClaim: claimName: nextcloud-pvc --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: nextcloud-pvc spec: accessModes: - ReadWriteOnce resources: requests: storage: 20Gi --- apiVersion: v1 kind: Service metadata: name: nextcloud labels: app.kubernetes.io/name: nextcloud spec: selector: app.kubernetes.io/name: nextcloud ports: - name: http port: 80 targetPort: http