---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    component: prometheus
  name: prometheus
  namespace: app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: prometheus
  template:
    metadata:
      labels:
        app: prometheus
    spec:
      serviceAccountName: app-prometheus
      containers:
        - name: prometheus
          resources:
            requests:
              memory: 512Mi
          image: prom/prometheus:v2.11.0
          command:
            - "prometheus"
            - "--config.file=/etc/prometheus/prometheus.yml"
          imagePullPolicy: Always
          livenessProbe:
            httpGet:
              path: /-/healthy
              port: 9090
            timeoutSeconds: 30
          readinessProbe:
            httpGet:
              path: /-/healthy
              port: 9090
            timeoutSeconds: 30
          ports:
            - containerPort: 9090
              protocol: TCP
          volumeMounts:
            - mountPath: /etc/prometheus/prometheus.yml
              name: prometheus-config
              subPath: prometheus.yml
            - mountPath: /prometheus/data
              name: prom-data
      volumes:
        - name: prometheus-config
          configMap:
            name: prometheus-config
            items:
              - key: prometheus.yml
                path: prometheus.yml
                mode: 0644
        - name: prom-data
          emptyDir: {}
