feat(alertmanager): Add alerting system from Prometheus rules

This commit is contained in:
Tanguy Herbron 2023-11-19 00:33:36 +01:00
parent ea058e912e
commit bff6712c3a
6 changed files with 67 additions and 3 deletions

View File

@ -0,0 +1,13 @@
apiVersion: monitoring.coreos.com/v1
kind: Alertmanager
metadata:
name: core
namespace: monitoring
spec:
replicas: 1
alertmanagerConfigSelector:
matchLabels:
alertmanagerConfig: core
alertmanagerConfigMatcherStrategy:
type: None
logLevel: debug

View File

@ -0,0 +1,22 @@
apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
name: alertmanager-core-config
namespace: monitoring
labels:
alertmanagerConfig: core
spec:
route:
groupBy: ['alertname']
groupWait: 30s
groupInterval: 5m
repeatInterval: 1h
receiver: discord
continue: true
receivers:
- name: discord
discordConfigs:
- apiURL:
name: discord-webhook
key: url
sendResolved: true

View File

@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- alertmanager.yaml
- config.yaml
- service.yaml

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: alertmanager-svc
namespace: monitoring
spec:
ports:
- name: web
port: 9093
protocol: TCP
targetPort: web
selector:
alertmanager: discord

View File

@ -1,3 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- serviceaccount.yaml
- clusterrole.yaml
@ -6,3 +9,4 @@ resources:
- ingress.yaml
- servicemonitor.yaml
- prometheus.yaml
- alertmanager

View File

@ -7,9 +7,7 @@ spec:
serviceAccountName: prometheus
serviceMonitorNamespaceSelector: {}
serviceMonitorSelector: {}
podMonitorSelector:
matchLabels:
team: core
podMonitorSelector: {}
resources:
requests:
memory: 300Mi
@ -24,3 +22,10 @@ spec:
runAsNonRoot: true
fsGroup: 2000
runAsUser: 1000
alerting:
alertmanagers:
- namespace: monitoring
name: alertmanager-svc
port: web
ruleSelector: {}
ruleNamespaceSelector: {}