--- # AlertManager ConfigMap with routing rules apiVersion: v1 kind: ConfigMap metadata: name: alertmanager-config namespace: gravl-staging labels: app: gravl component: alerting data: alertmanager.yml: | global: resolve_timeout: 5m route: receiver: 'default' group_by: ['alertname', 'cluster', 'service'] group_wait: 10s group_interval: 10s repeat_interval: 12h routes: - match: severity: critical receiver: 'slack-critical' group_wait: 0s repeat_interval: 1h - match: severity: warning receiver: 'slack-warnings' group_wait: 5s repeat_interval: 4h - match: severity: info receiver: 'email-ops' group_wait: 30s repeat_interval: 24h receivers: - name: 'default' webhook_configs: - url: 'http://localhost:5001/' - name: 'slack-critical' slack_configs: - channel: '#gravl-critical' title: '🚨 CRITICAL: {{ .GroupLabels.alertname }}' text: '{{ range .Alerts }}{{ .Annotations.description }}{{ end }}' color: 'danger' send_resolved: true api_url: 'https://hooks.slack.com/services/EXAMPLE/WEBHOOK/URL' - name: 'slack-warnings' slack_configs: - channel: '#gravl-warnings' title: '⚠️ Warning: {{ .GroupLabels.alertname }}' text: '{{ range .Alerts }}{{ .Annotations.description }}{{ end }}' color: 'warning' send_resolved: true api_url: 'https://hooks.slack.com/services/EXAMPLE/WEBHOOK/URL' - name: 'email-ops' email_configs: - to: 'ops@gravl.io' from: 'alertmanager@gravl.io' smarthost: 'smtp.example.com:587' auth_username: 'user@example.com' auth_password: 'password' --- # AlertManager Deployment apiVersion: apps/v1 kind: Deployment metadata: name: alertmanager namespace: gravl-staging labels: app: gravl component: alerting spec: replicas: 1 selector: matchLabels: app: gravl component: alerting template: metadata: labels: app: gravl component: alerting spec: serviceAccountName: alertmanager containers: - name: alertmanager image: prom/alertmanager:latest imagePullPolicy: IfNotPresent args: - '--config.file=/etc/alertmanager/alertmanager.yml' - '--storage.path=/alertmanager' - '--log.level=info' ports: - name: http containerPort: 9093 protocol: TCP volumeMounts: - name: config mountPath: /etc/alertmanager - name: storage mountPath: /alertmanager livenessProbe: httpGet: path: /-/healthy port: 9093 initialDelaySeconds: 30 periodSeconds: 10 readinessProbe: httpGet: path: /-/ready port: 9093 initialDelaySeconds: 10 periodSeconds: 5 resources: requests: cpu: 100m memory: 128Mi limits: cpu: 200m memory: 256Mi volumes: - name: config configMap: name: alertmanager-config - name: storage emptyDir: {} --- # AlertManager Service apiVersion: v1 kind: Service metadata: name: alertmanager namespace: gravl-staging labels: app: gravl component: alerting spec: type: ClusterIP selector: app: gravl component: alerting ports: - name: http port: 9093 targetPort: http protocol: TCP --- # Service Account for AlertManager apiVersion: v1 kind: ServiceAccount metadata: name: alertmanager namespace: gravl-staging labels: app: gravl component: alerting