apiVersion: apps/v1
kind: Deployment
metadata:
  name: prometheus
spec:
  selector:
    matchLabels:
      app: prometheus
      env: production
  replicas: 1
  template:
    metadata:
      labels:
        app: prometheus
        env: production
    spec:
      serviceAccountName: prometheus
      containers:
      - name: prometheus
        image: gcr.io/dd-decaf-cfbf6/prometheus:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 9090
        resources:
          requests:
            cpu: "0"
        volumeMounts:
          - mountPath: "/prometheus"
            name: prometheus
        securityContext:
          runAsUser: 0
      - name: grafana
        image: grafana/grafana:5.0.4
        ports:
        - containerPort: 3000
        env:
        - name: GF_SECURITY_ADMIN_PASSWORD
          valueFrom:
            secretKeyRef:
              name: prometheus
              key: GF_SECURITY_ADMIN_PASSWORD
        resources:
          requests:
            cpu: "0"
        volumeMounts:
          - mountPath: "/var/lib/grafana"
            name: grafana
      - name: blackbox-exporter
        image: prom/blackbox-exporter
        ports:
        - containerPort: 9115
        resources:
          requests:
            cpu: "0"
      volumes:
        - name: prometheus
          persistentVolumeClaim:
           claimName: prometheus
        - name: grafana
          persistentVolumeClaim:
           claimName: grafana
