summaryrefslogtreecommitdiff
path: root/f3s/argocd-apps/monitoring/prometheus.yaml
blob: 854948fcc87995aafad9b68ce1c3456318ab9e6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: prometheus
  namespace: cicd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: default

  sources:
    # Source 1: Upstream Helm chart from prometheus-community
    - repoURL: https://prometheus-community.github.io/helm-charts
      chart: kube-prometheus-stack
      targetRevision: 55.5.0
      helm:
        releaseName: prometheus
        valuesObject:
          kubeEtcd:
            enabled: true
            endpoints:
              - 192.168.2.120
              - 192.168.2.121
              - 192.168.2.122
            service:
              enabled: true
              port: 2381
              targetPort: 2381

          kubeControllerManager:
            enabled: true
            endpoints:
              - 192.168.2.120
              - 192.168.2.121
              - 192.168.2.122
            service:
              enabled: true
              port: 10257
              targetPort: 10257
            serviceMonitor:
              enabled: true
              https: true
              insecureSkipVerify: true

          # k3s embeds kube-proxy and kube-scheduler into the main process
          # Disable these components to prevent false-positive alerts
          kubeProxy:
            enabled: false

          kubeScheduler:
            enabled: false

          # Disable alert rules for components not available in k3s
          defaultRules:
            rules:
              kubeProxy: false
              kubeSchedulerAlerting: false
              kubeSchedulerRecording: false
              kubeScheduler: false

          prometheus:
            prometheusSpec:
              additionalArgs:
                - name: web.enable-remote-write-receiver
                  value: ""
                - name: web.enable-admin-api
                  value: ""
              enableFeatures:
                - exemplar-storage
                - otlp-write-receiver
              additionalScrapeConfigs: []
              tsdb:
                outOfOrderTimeWindow: 744h  # 31 days
              additionalScrapeConfigsSecret:
                enabled: true
                name: additional-scrape-configs
                key: additional-scrape-configs.yaml
              storageSpec:
                volumeClaimTemplate:
                  spec:
                    storageClassName: ""
                    accessModes: ["ReadWriteOnce"]
                    resources:
                      requests:
                        storage: 10Gi
                    selector:
                      matchLabels:
                        type: local
                        app: prometheus

          alertmanager:
            config:
              global:
                resolve_timeout: 5m
              route:
                group_by: ['alertname', 'namespace', 'severity']
                group_wait: 30s
                group_interval: 5m
                repeat_interval: 12h
                receiver: 'default'
                routes:
                  # Watchdog alert is just for testing, suppress it
                  - matchers:
                      - alertname = "Watchdog"
                    receiver: 'null'
                  # ArgoCD application alerts - high priority
                  - matchers:
                      - component = "argocd"
                    receiver: 'argocd-alerts'
                    group_by: ['alertname', 'name', 'severity']
                    group_wait: 10s
                    repeat_interval: 6h
              receivers:
                - name: 'null'
                - name: 'default'
                  # Default receiver - alerts visible in UI only
                - name: 'argocd-alerts'
                  # ArgoCD-specific receiver - alerts visible in UI only
                  # Future: add email/slack/webhook configuration here
              inhibit_rules:
                # Inhibit info alerts if warning or critical is firing
                - source_matchers:
                    - severity = "critical"
                  target_matchers:
                    - severity =~ "warning|info"
                  equal: ['namespace', 'alertname']
                - source_matchers:
                    - severity = "warning"
                  target_matchers:
                    - severity = "info"
                  equal: ['namespace', 'alertname']

          grafana:
            persistence:
              enabled: true
              type: pvc
              existingClaim: "grafana-data-pvc"

            initChownData:
              enabled: false

            podSecurityContext:
              fsGroup: 911
              runAsUser: 911
              runAsGroup: 911

            # Disable sidecar-based datasource provisioning
            sidecar:
              datasources:
                enabled: false

            # Mount datasources ConfigMap directly to provisioning directory
            extraVolumes:
              - name: datasources-volume
                configMap:
                  name: grafana-datasources-all

            extraVolumeMounts:
              - name: datasources-volume
                mountPath: /etc/grafana/provisioning/datasources
                readOnly: true

    # Source 2: Additional manifests from Git repository
    - repoURL: https://codeberg.org/snonux/conf.git
      targetRevision: master
      path: f3s/prometheus/manifests

  destination:
    server: https://kubernetes.default.svc
    namespace: monitoring

  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=false
      - ServerSideApply=true
    retry:
      limit: 3
      backoff:
        duration: 10s
        factor: 2
        maxDuration: 3m