apiVersion: apps/v1
kind: Deployment
metadata:
  name: prometheus-deployment
  namespace: monitoring-system
  labels:
    app.kubernetes.io/name: prometheus
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: prometheus
  template:
    metadata:
      labels:
        app.kubernetes.io/name: prometheus
    spec:
      containers:
      - name: prometheus
        image: quay.io/prometheus/prometheus:v2.22.0
        imagePullPolicy: IfNotPresent
        resources:
          requests:
            memory: "1Gi"
            cpu: "1"
          limits:
            memory: "2Gi"
            cpu: "1.5"
        args:
        - '--config.file=/etc/prometheus/prometheus-config.yaml'
        - '--storage.tsdb.path=/prometheus'
        - '--web.enable-lifecycle'
        ports:
        - name: web
          containerPort: 9090
        volumeMounts:
        - name: conf
          mountPath: /etc/prometheus
          readOnly: true
        - name: data
          mountPath: /prometheus
      restartPolicy: Always
      volumes:
      - name: conf
        configMap:
          name: prometheus-config
      - name: data
        emptyDir: {}
