apiVersion: apps/v1
kind: Deployment
metadata:
  name: tgbuser-grpc
  labels:
    app: tgbuser-grpc
spec:
  replicas: 2
  selector:
    matchLabels:
      app: tgbuser-grpc
  template:
    metadata:
      labels:
        app: tgbuser-grpc
        name: tgbuser-grpc
    spec:
        containers:
          - name: tgbuser-grpc
            image: localhost:32000/tgbuser-grpc:latest
            env:
             - name: ENV
               value: "production"
             - name: NATS_SERVICE_URL
               value: "nats://nats-svc:4222"
             - name: DATA_SOURCE_URL
               value: "tgbdb/data.db"
             - name: APPLICATION_PORT
               value: "8080"
            volumeMounts:
              - name: db
                mountPath: "/app/tgbdb"
        volumes:
          - name: db
            persistentVolumeClaim:
              claimName: tgbuser-grpc-pvc

---
 apiVersion: v1
 kind: PersistentVolumeClaim
 metadata:
   name: tgbuser-grpc-pvc
 spec:
   storageClassName: nfs-csi
   accessModes: [ReadWriteMany]
   resources:
     requests:
       storage: 30Mi
---
apiVersion: v1
kind: Service
metadata:
  name: tgbuser-grpc-svc
spec:
  selector:
    app: tgbuser-grpc
  ports:
    - port: 80
      protocol: TCP
      targetPort: 8080
      name: grpc
  type: LoadBalancer