apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: prometheus
  namespace: ethereum-2
  labels:
    app.kubernetes.io/name: prometheus
    app.kubernetes.io/version: v2.25.2
spec:
  serviceName: prometheus
  selector:
    matchLabels:
      app.kubernetes.io/name: prometheus
  template:
    metadata:
      labels:
        app.kubernetes.io/name: prometheus
        app.kubernetes.io/version: v2.25.2
    spec:
      serviceAccountName: prometheus
      containers:
      - name: prometheus
        image: docker.io/prom/prometheus:v2.25.2
        args:
        - --config.file=/etc/prometheus/prometheus.yml
        - --storage.tsdb.path=/var/lib/prometheus
        ports:
        - name: metrics
          containerPort: 9090
        resources:
          requests:
            cpu: 50m
            memory: 250Mi
          limits:
            cpu: 100m
            memory: 500Mi
        volumeMounts:
        - name: config
          mountPath: /etc/prometheus/prometheus.yml
          subPath: prometheus.yml
          readOnly: true
        - name: config
          mountPath: /etc/prometheus/alerting_rules.yml
          subPath: alerting_rules.yml
          readOnly: true
        - mountPath: /var/lib/prometheus
          name: data
        readinessProbe:
          httpGet:
            path: /-/ready
            port: metrics
          failureThreshold: 5
          initialDelaySeconds: 60
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 30
        livenessProbe:
          httpGet:
            path: /-/healthy
            port: metrics
          failureThreshold: 5
          initialDelaySeconds: 600
          periodSeconds: 60
          successThreshold: 1
          timeoutSeconds: 30
        securityContext:
          runAsNonRoot: true
          runAsUser: 65534
          readOnlyRootFilesystem: true
          capabilities:
            drop: ["ALL"]
      securityContext:
        fsGroup: 65534
      terminationGracePeriodSeconds: 300
      volumes:
      - name: config
        configMap:
          name: prometheus
  volumeClaimTemplates:
  - metadata:
      name: data
    spec:
      storageClassName: standard-rwo
      accessModes:
      - ReadWriteOnce
      volumeMode: Filesystem
      resources:
        requests:
          storage: 2Gi
