apiVersion: apps/v1
kind: StatefulSet

metadata:
  name: prometheus
  namespace: monitoring

spec:
  serviceName: prometheus
  replicas: 1
  selector:
    matchLabels:
      app: prometheus

  template:
    metadata:
      labels:
        app: prometheus

    spec:
      serviceAccountName: prometheus
      containers:
        - name: prometheus
          image: prom/prometheus:v2.18.1
          resources:
            requests:
              cpu: 50m
              memory: 100Mi
            limits:
              cpu: 200m
              memory: 400Mi
          ports:
            - name: prometheus
              containerPort: 9090
          args:
            - --config.file=/etc/prometheus/prometheus.yaml
          volumeMounts:
            - name: prometheus-config
              mountPath: /etc/prometheus
            - name: prometheus-storage
              mountPath: /data
      volumes:
        - name: prometheus-config
          configMap:
            name: prometheus
        - name: prometheus-storage
          persistentVolumeClaim:
            claimName: prometheus
