apiVersion: v1
kind: Service
metadata:
  name: nextcloud-server
  namespace: nextcloud
  labels:
    app: nextcloud
spec:
  selector:
    pod-label: nextcloud-server-pod
  type: NodePort
  ports:
    - port: 80
      nodePort: 30289
      targetPort: nextcloud
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nextcloud-server
  namespace: nextcloud
  labels:
    app: nextcloud
spec:
  replicas: 1
  selector:
    matchLabels:
      pod-label: nextcloud-server-pod
  template:
    metadata:
      labels:
        pod-label: nextcloud-server-pod
    spec:
      containers:
      - name: nextcloud
        image: nextcloud
        volumeMounts:
        - name: server-storage
          mountPath: /var/www/html
          subPath: server-data
        ports:
        - containerPort: 80
          name: nextcloud
      volumes:
      - name: server-storage
        persistentVolumeClaim:
          claimName: dbnc-pv-claim

