apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: prometheus
  name: prometheus
  namespace: default
spec:
  serviceName: prometheus
  replicas: 1
  selector:
    matchLabels:
      app: prometheus
  template:
    metadata:
      labels:
        app: prometheus
    spec:
      containers:
      - image: prom/prometheus
        imagePullPolicy: Always
        name: prometheus
        resources:
          limits:
            cpu: "1"
          requests:
            cpu: "0.05"
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: "/prometheus-data"
          name: prometheus-storage
        - mountPath: /etc/prometheus
          name: config
        args: ['--web.listen-address=127.0.0.1:9080', '--config.file=/etc/prometheus/prometheus.yml', '--storage.tsdb.path=/prometheus-data/data']
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 10
      volumes:
      - name: config
        configMap:
          name: extrafiles
          items:
          - key: prometheus.yml
            path: prometheus.yml
  volumeClaimTemplates:
  - metadata:
      name: prometheus-storage
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 5Gi

