# ============================================================================= # Prometheus (TASK-0135, phase-15) — Deployment + PVC + Service, ns `monitoring`. # # Config is generated into `prometheus-config` by kustomization.yaml FROM # infrastructure/observability/prometheus/ (single source of truth): # /etc/prometheus/prometheus.yml (scrape + rule_files + alerting) # /etc/prometheus/rules/recording-rules.yaml # /etc/prometheus/rules/alerts.yaml # Retention 7 d (the 14-day cert alert needs >14 d of history for its # avg_over_time-free expr, but 7 d is the staging default — bump if the # dashboards' 30 d views matter). # Image pinned: prom/prometheus:v2.51.0 (the 2.51 LTS line — classic text # format + the rule files above are 2.x syntax). # ============================================================================= apiVersion: v1 kind: PersistentVolumeClaim metadata: name: prometheus-data namespace: monitoring labels: app.kubernetes.io/name: prometheus app.kubernetes.io/part-of: ai-software-factory spec: accessModes: ["ReadWriteOnce"] resources: requests: storage: 10Gi --- apiVersion: apps/v1 kind: Deployment metadata: name: prometheus namespace: monitoring labels: app.kubernetes.io/name: prometheus app.kubernetes.io/part-of: ai-software-factory spec: replicas: 1 selector: matchLabels: app.kubernetes.io/name: prometheus strategy: type: Recreate template: metadata: labels: app.kubernetes.io/name: prometheus spec: securityContext: runAsNonRoot: true runAsUser: 65534 # the `prom` user in the official image runAsGroup: 65534 fsGroup: 65534 containers: - name: prometheus image: prom/prometheus:v2.51.0 imagePullPolicy: IfNotPresent args: - --config.file=/etc/prometheus/prometheus.yml - --storage.tsdb.path=/prometheus - --storage.tsdb.retention.time=7d - --web.enable-lifecycle ports: - containerPort: 9090 name: http volumeMounts: - name: config mountPath: /etc/prometheus readOnly: true - name: data mountPath: /prometheus readinessProbe: httpGet: path: /-/ready port: 9090 initialDelaySeconds: 10 periodSeconds: 10 livenessProbe: httpGet: path: /-/healthy port: 9090 initialDelaySeconds: 30 periodSeconds: 15 resources: requests: cpu: 250m memory: 512Mi limits: cpu: "1" memory: 2Gi volumes: - name: config configMap: name: prometheus-config # name rewritten to the hashed name by kustomize - name: data persistentVolumeClaim: claimName: prometheus-data --- apiVersion: v1 kind: Service metadata: name: prometheus namespace: monitoring labels: app.kubernetes.io/name: prometheus app.kubernetes.io/part-of: ai-software-factory spec: selector: app.kubernetes.io/name: prometheus ports: - name: http port: 9090 targetPort: 9090