---
apiVersion: apps/v1 # for versions before 1.6.0 use extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: prometheus
    component: core
  name: prometheus
  namespace: monitoring
spec:
  selector:
    matchLabels:
      app: prometheus
      component: core
  replicas: 1
  template:
    metadata:
      labels:
        app: prometheus
        component: core
      annotations:
        sidecar.istio.io/inject: "false"
        checksum/prometheus-config: "2afc6c40cb4846231cc487145722776289239f56ddb061c208c93aa06701a0db"
    spec:
      serviceAccountName: prometheus
      containers:
      - name: prometheus
        resources:
          requests:
            memory: "512Mi"
        image: prom/prometheus:v2.7.1
        command:
          - "prometheus"
          - "--config.file=/etc/prometheus/prometheus.yml"
        imagePullPolicy: Always
        livenessProbe:
          exec:
            command:
            - wget
            - --quiet
            - --tries=1
            - --timeout=30
            - --spider
            - http://localhost:9090/-/healthy
          timeoutSeconds: 30
        readinessProbe:
          exec:
            command:
            - wget
            - --quiet
            - --tries=1
            - --timeout=30
            - --spider
            - http://localhost:9090/-/healthy
          timeoutSeconds: 30
        ports:
        - containerPort: 9090
          protocol: TCP
        volumeMounts:
        - mountPath: /etc/prometheus/prometheus.yml
          name: prometheus-config
          subPath: prometheus.yml
        - mountPath: /etc/prometheus/alert.rules.yml
          name: prometheus-config
          subPath: alert.rules.yml
        - mountPath: /prometheus/data
          name: prom-data
        - name: rules-volume
          mountPath: /etc/prometheus-rules
      volumes:
        - name: prometheus-config
          configMap:
            name: prometheus-config
            items:
              - key: prometheus.yml
                path: prometheus.yml
                mode: 0644
              - key: alert.rules.yml
                path: alert.rules.yml
                mode: 0644
        - name: prom-data
          emptyDir: {}
        - name: rules-volume
          configMap:
            name: prometheus-rules
