helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

[kube-prometheus-stack] How can I use a configmap to load AlertManager config

Open morkalfon opened this issue 11 months ago • 1 comments

Hello,

I'm looking for a way to load AlertManger configuration from a ConfigMap. The following value is available on the helm chart: https://github.com/prometheus-community/helm-charts/blob/79978b9a349e2fb6c285b8f1d527f264c2d40a8d/charts/kube-prometheus-stack/values.yaml#L643

When trying to supply a configmap which resides on the same namespace as AlertManger, it doesn't mount the configmap to the AlertManger pod.

Any ideas what should I check to troubleshoot this?

Thanks!

morkalfon avatar Feb 27 '24 09:02 morkalfon

When trying to supply a configmap which resides on the same namespace as AlertManger, it doesn't mount the configmap to the AlertManger pod.

Regarding configMaps, they do normally get mounted by the operator at the mountpoint /etc/alertmanager/configmaps/<configmap-name> in the alertmanager container (see configMaps in AlertmanagerSpec). However, this is also everything the operator does in this respect - the files will merely be available in the container at that location. They can be further used e.g. for backing alertmanager's configuration parameters *_file or as template files.

I'm looking for a way to load AlertManger configuration from a ConfigMap.

Alertmanager's configuration can come from a secret, AlertmanagerConfig CRs (or a combination of both), not from a configmap.

If we consider an existing secret, there are these options:

  1. Creating a secret and setting alertmanager.alertmanagerSpec.configSecret to the name of that secret (see values' configSecret and configSecret in AlertmanagerSpec).
  2. Creating a secret with the required name alertmanager-ALERTMANAGER_CR_NAME (see here) and setting alertmanager.alertmanagerSpec.useExistingSecret (values' useExistingSecret). Prometheus Operator will then pick a secret with the expected name up.

zeritti avatar Feb 28 '24 20:02 zeritti