应用这些 list 后 https://github.com/prometheus-operator/kube-prometheus/blob/main/kustomization.yaml我想创建 AlertManager
webhook:
apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
name: custom
spec:
route:
receiver: custom
groupBy: ['job']
groupWait: 30s
groupInterval: 5m
repeatInterval: 12h
receivers:
- name: custom
webhook_configs:
- send_resolved: true
url: https://example.com
出现错误:
错误:验证“alertmanagerconfig.yaml”时出错:验证数据时出错:ValidationError(AlertmanagerConfig.spec.receivers[0]):com.coreos.monitoring.v1alpha1.AlertmanagerConfig.spec 中的未知字段“webhook_configs”。接收者;如果您选择忽略这些错误,请使用 --validate=false 关闭验证
如何解决?
最佳答案
问题是您使用的是实际 AlertManager 应用程序的配置引用,而不是 Prometheus Operator 提供的 Kubernetes 自定义资源的配置引用。
Prometheus Operator 采用以自定义资源(如 AlertManagerConfig)形式提供的配置,并将它们转换为实际的 AlertManager 配置,并更新应用程序使用的配置文件。这就是您首先使用运算符的部分原因。它使这些事情对您来说很方便。
所以你在这里应该使用的实际配置引用是this . 这part Prometheus Operator 的 github 自述文件列出了您可以使用它的可用自定义资源。
关于kubernetes - Prometheus operator AlertmanagerConfig 未知字段 "webhook_configs",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66418893/