apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: prometheus
  namespace: openfaas
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: prometheus
    spec:
      containers:
      - name: prometheus
        image: functions/prometheus:2.2.0-armhf
        command: 
          - "prometheus"
          - "--config.file=/etc/prometheus/prometheus.yml"
        imagePullPolicy: Always
        ports:
        - containerPort: 9090
          protocol: TCP
        resources:
          requests:
            memory: 250Mi
          limits:
            memory: 250Mi
        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
      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
---
apiVersion: v1
kind: Service
metadata:
  name: prometheus
  namespace: openfaas
  labels:
    app: prometheus
spec:
  type: NodePort
  ports:
    - port: 9090
      protocol: TCP
      targetPort: 9090
      nodePort: 31119
  selector:
    app: prometheus
