---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: prometheus
  labels:
    app: prometheus
  namespace: monitoring
spec:
  replicas: 1
  selector:
    matchLabels:
      app: prometheus
  template:
    metadata:
      labels:
        app: prometheus
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "9090"
    spec:
      containers:
        - name: prometheus
          image: prom/prometheus:v2.11.1
          imagePullPolicy: IfNotPresent
          resources:
            requests:
              cpu: 100m
              memory: 256Mi
            limits:
              cpu: 500m
              memory: 512Mi
          env:
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
          volumeMounts:
            - name: prometheus-config
              mountPath: /etc/prometheus/
              readOnly: true
          ports:
            - containerPort: 9090
              name: http
              protocol: TCP
          command:
            - /bin/prometheus
          args:
            - --config.file=/etc/prometheus/prometheus.yml
      volumes:
        - name: prometheus-config
          configMap:
            name: besu-prometheus-configmap
            items:
              - key: prometheus.yml
                path: prometheus.yml
