apiVersion: apps/v1 kind: Deployment metadata: name: postgres namespace: nextcloud spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: postgres template: metadata: labels: app: postgres spec: containers: - image: postgres:12.2-alpine imagePullPolicy: IfNotPresent name: postgres env: - name: POSTGRES_USER valueFrom: secretKeyRef: name: postgres key: POSTGRES_USER - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: postgres key: POSTGRES_PASSWORD resources: requests: memory: "128Mi" cpu: "100m" limits: memory: "512Mi" cpu: "1000m" livenessProbe: tcpSocket: port: 5432 initialDelaySeconds: 15 periodSeconds: 30 timeoutSeconds: 5 successThreshold: 1 failureThreshold: 2 ports: - containerPort: 5432 volumeMounts: - name: postgres-data mountPath: /var/lib/postgresql/data volumes: - name: postgres-data hostPath: path: /opt/nextcloud/postgres type: Directory