apiVersion: apps/v1
kind: Deployment
metadata:
  name: prometheus-deployment
  namespace: monitoring
spec:
  replicas: 1
  selector:
    matchLabels:
      app: prometheus
  template:
    metadata:
      labels:
        app: prometheus
      name: prometheus
    spec:
      containers:
        - args:
            - --storage.tsdb.retention.time=360h
            - --config.file=/etc/prometheus/prometheus.yml
          image: prom/prometheus:v2.25.2
          imagePullPolicy: IfNotPresent
          name: prometheus
          ports:
            - containerPort: 9090
              name: web
              protocol: TCP
          volumeMounts:
            - mountPath: /etc/prometheus
              name: config-volume
            - mountPath: /etc/prometheus-rules
              name: alertrules-volume
      serviceAccount: prometheus
      serviceAccountName: prometheus
      volumes:
        - configMap:
            defaultMode: 420
            name: prometheus-configmap
          name: config-volume
        - configMap:
            defaultMode: 420
            name: prometheus-alertrules
          name: alertrules-volume
