kubernetes - Prometheus operator AlertmanagerConfig 未知字段 "webhook_configs"

标签 kubernetes prometheus-alertmanager prometheus-operator

应用这些 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/

相关文章:

docker - 用于执行Pod的模式在该Pod中具有来自容器的标签

prometheus - 普罗米修斯中速率函数的总和

docker - 如何更改Prometheus监控的cadvisor和node-exporter中的端口号

kubernetes - 连接Redis导出器和Prometheus运算符

kubernetes - 使用稳定的 Helm 图在kubernetes中安装cert-manager后无法对证书执行描述

kubernetes -/, Kind=NetworkPolicy 没有匹配项

dns - 在 Kubernetes 集群外访问 kube-dns

kubernetes - volumeMount subPath 不起作用

Kubernetes Prometheus CrashLoopBackOff/OOMKilled Puzzle

Kubernetes 自动缩放 : HPA not working with custom metrics for Java Netty API