apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-flask
  labels:
    app: hello-flask
spec:
  replicas: 3
  selector:
    matchLabels:
      app: hello-flask
  template:
    metadata:
      labels:
        app: hello-flask
    spec:
      containers:
      - name: hello-flask
        image: jmsearcy/hello-flask:latest
        ports:
        - containerPort: 8080
        command: ["gunicorn", "hello:app", "--config=config.py"]
        imagePullPolicy: Always
        env:
          - name: APP_PORT
            value: "8080"
          - name: APP_DEBUG
            value: "0"
          - name: POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
          - name: NAMESPACE_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
        livenessProbe:
          httpGet:
            scheme: HTTP
            port: 8080
            path: /healthz
          initialDelaySeconds: 3
          periodSeconds: 10
        readinessProbe:
          httpGet:
            scheme: HTTP
            port: 8080
            path: /readyz
          initialDelaySeconds: 3
          periodSeconds: 10
        resources:
          limits:
            cpu: 200m
            memory: 256Mi
          requests:
            cpu: 10m
            memory: 32Mi
