我正在从kube-prometheus-stack头盔图中部署一个监视堆栈,并且我正在尝试配置警报管理器,以便它具有在Slack通道中进行警报的自定义配置。
吊舱中的配置是从/etc/alertmanager/config/alertmanager.yaml加载的。根据荚描述,这个文件是从自动生成的秘密中加载的:
...
volumeMounts:
- mountPath: /etc/alertmanager/config
name: config-volume
...
volumes:
- name: config-volume
secret:
defaultMode: 420
secretName: alertmanager-prometheus-community-kube-alertmanager-generated如果我检查这个秘密,它包含在alertmanager.config中的默认值中找到的默认配置,我打算覆盖它。
如果我将以下配置传递给警报管理器以重新安装图表,则不会创建警报管理器荚:
alertmanager:
config:
global:
resolve_timeout: 5m
route:
group_by: ['job', 'alertname', 'priority']
group_wait: 10s
group_interval: 1m
routes:
- match:
alertname: Watchdog
receiver: 'null'
- receiver: 'slack-notifications'
continue: true
receivers:
- name: 'slack-notifications'
slack-configs:
- slack_api_url: <url here>
title: '{{ .Status }} ({{ .Alerts.Firing | len }}): {{ .GroupLabels.SortedPairs.Values | join " " }}'
text: '<!channel> {{ .CommonAnnotations.summary }}'
channel: '#mychannel'首先,如果我没有在values.yaml中传递任何配置,那么就成功地创建了警报管理器pod。
如何正确地覆盖警报管理器的配置,以便将使用自定义配置的正确文件装入/etc/alertmanger/config/alertmanager.yaml
发布于 2022-04-20 11:20:56
也许以下步骤可以解决您的问题
1)从自定义alertmanager.yaml文件创建Config映射
kubectl create configmap <name_of_the_configmap> --from-file=<path_and_name_of_thefile>2)将Configmap作为卷安装到容器。
...
volumeMounts:
- mountPath: /etc/alertmanager/config
name: config-volume
volumes:
- name: config-volume
configMap:
# Provide the name of the ConfigMap containing the files you want
# to add to the container
name: <ConfigMap_Name_Created>3)挂载configmap将覆盖容器内的文件。
https://stackoverflow.com/questions/71924744
复制相似问题