apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-proxy-deployment
  labels:
    app: nginx-proxy-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx-app
  template:
    metadata:
      labels:
        app: nginx-app
    spec:
      containers:
      - name: nginx-app
        image: nginx:latest
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports:
          - name: nginx-port
            containerPort: 80
        livenessProbe:
            httpGet:
              path: /
              port: nginx-port
            initialDelaySeconds: 15
            timeoutSeconds: 30
        readinessProbe:
            httpGet:
              path: /
              port: nginx-port
            initialDelaySeconds: 15
            timeoutSeconds: 30
        volumeMounts:
          - name: config-volume
            mountPath: /etc/nginx/conf.d
      - name: flask-sample
        image: skilfulll1/flask-sample
        # command: ["python", "app.py"]
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports:
          - name: flask-port
            containerPort: 5000
        # env:
        #   - name:  DB_HOST
        #     value: db-service
        #   - name:  DB_USER
        #     value: root
        #   - name: DB_PASSWORD
        #     valueFrom:
        #       secretKeyRef:
        #         name:  secrets
        #         key:  rootPassword
        #   - name: DB_NAME
        #     valueFrom:
        #       secretKeyRef:
        #         name:  secrets
        #         key:  database
        livenessProbe:
            httpGet:
              path: /
              port: flask-port
            initialDelaySeconds: 15
            timeoutSeconds: 30
        readinessProbe:
            httpGet:
              path: /
              port: flask-port
            initialDelaySeconds: 15
            timeoutSeconds: 30
      volumes:
        - name: config-volume
          configMap:
            name: nginx-config
            items:
              - key: reverseproxy.conf
                path: reverseproxy.conf

