Mahnoor Fatima
Mahnoor Fatima

Reputation: 29

modify args for alertmanager in kube prometheus stack

I need help and guidance about modifying the manifest in alertmanager

Result: Get alert notifications on teams via webhook. Where: kube prometheus stack deployed via argocd Solution: So I added a configmap with routes and recivers and mount it as volume to alertmanager spec as follow

alertmanager:
  alertmanagerSpec:
    image:
      repository: {{ .Values.spec.monitoring.images.altermanager.repository }}
      tag: {{ .Values.spec.monitoring.images.altermanager.tag }}
    args:
      - '--config.file=/etc/alertmanager/alertmanager.yaml'
    volumeMounts:
    - name: config-volume-alertmanager
      mountPath: /etc/alertmanager
    tolerations:
    - key: "monitoring"
      operator: "Equal"
      value: "true"
      effect: "NoSchedule"
    volumes:
    - name: config-volume-alertmanager
      configMap:
        name: alertmanager

the configMap name is alertmanager and looks like this

apiVersion: v1
kind: ConfigMap
metadata:
  name:  alertmanager
  namespace: {{ .Values.shared.global.namespace }}
data:
 alertmanager.yml: |-
   global:
      resolve_timeout: 5m
      route:
        group_wait: 30s
        group_interval: 10s
        repeat_interval: 10s
        receiver: app-prometheus-msteams
        routes:
          - match:
            alertname: Watchdog
            receiver: 'app-prometheus-msteams'
      receivers:
      - name: 'null'
      - name: app-prometheus-msteams
        webhook_configs: 
        - send_resolved: true
          url: {{ .Values.shared.global.alertmanager.webhook }}

Issue: It modifies the existing manifest and adds volume to it but its not updating the --config.file to the path where I wants it to read alertmanager.yaml. Please guide me if I am in right direction or how I can modify alertmanager to read the new yaml file.

Upvotes: 0

Views: 819

Answers (1)

hiroyukik
hiroyukik

Reputation: 814

Kubernetes doesn't rollout Pods when configmap is changed. You need to restart your all pods after change your configmap/secret.

How about using kustomize to put annotation to all your resources?

commonAnnotations could be helpful to change your deployment as well.

Here is a blog which is showing the solution for you.

https://codefresh.io/blog/using-argo-cd-and-kustomize-for-configmap-rollouts/

Upvotes: 0

Related Questions