apiVersion: apps/v1
kind: Deployment
metadata:
  name: prometheus
  namespace: the-order
spec:
  replicas: 1
  selector:
    matchLabels:
      app: prometheus
  template:
    metadata:
      labels:
        app: prometheus
    spec:
      containers:
      - name: prometheus
        image: prom/prometheus:latest
        ports:
        - containerPort: 9090
        args:
          - '--config.file=/etc/prometheus/prometheus.yml'
          - '--storage.tsdb.path=/prometheus'
          - '--web.console.libraries=/etc/prometheus/console_libraries'
          - '--web.console.templates=/etc/prometheus/consoles'
          - '--storage.tsdb.retention.time=30d'
        volumeMounts:
        - name: prometheus-config
          mountPath: /etc/prometheus
        - name: alert-rules
          mountPath: /etc/prometheus/alert-rules.yml
          subPath: alert-rules.yml
        - name: prometheus-storage
          mountPath: /prometheus
        resources:
          requests:
            memory: "512Mi"
            cpu: "200m"
          limits:
            memory: "2Gi"
            cpu: "1000m"
---
apiVersion: v1
kind: Service
metadata:
  name: prometheus
  namespace: the-order
spec:
  selector:
    app: prometheus
  ports:
  - port: 9090
    targetPort: 9090
  type: ClusterIP
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: prometheus-config
  namespace: the-order
data:
  prometheus.yml: |
    # Prometheus configuration will be mounted from infra/monitoring/prometheus-config.yml

