apiVersion: v1
kind: Service
metadata:
  name: vaultwarden
  namespace: vaultwarden
  labels:
    app: vaultwarden
spec:
  type: NodePort
  ports:
    - port: 80
      nodePort: 31078
      targetPort: vaultwarden
  selector:
    app: vaultwarden
    tier: frontend
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: vw-pv-claim
  namespace: vaultwarden
  labels:
    app: vaultwarden
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: ""
  resources:
    requests:
      storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vaultwarden
  namespace: vaultwarden
  labels:
    app: vaultwarden
spec:
  selector:
    matchLabels:
      app: vaultwarden
      tier: frontend
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: vaultwarden
        tier: frontend
    spec:
      containers:
      - image: vaultwarden/server
        #- image: docker-registry:32000/vaultwarden:1.0
        name: vaultwarden
        ports:
        - containerPort: 80
          name: vaultwarden
        volumeMounts:
        - name: vaultwarden-persistent-storage
          mountPath: /data
      imagePullSecrets:
      - name: reg-cred-secret
      volumes:
      - name: vaultwarden-persistent-storage
        persistentVolumeClaim:
          claimName: vw-pv-claim

