After applying these manifests https://github.com/prometheus-operator/kube-prometheus/blob/main/kustomization.yaml I want to create 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
getting an error:
error: error validating "alertmanagerconfig.yaml": error validating data: ValidationError(AlertmanagerConfig.spec.receivers[0]): unknown field "webhook_configs" in com.coreos.monitoring.v1alpha1.AlertmanagerConfig.spec.receivers; if you choose to ignore these errors, turn validation off with --validate=false
How to fix that?
I solved this issue by generating Kubernetes secret
named alertmanager-main
using this yaml:
global:
#skipped
route:
group_by: ['job']
receiver: Default
routes:
- receiver: Watchdog
repeat_interval: 1m
match:
alertname: Watchdog
receivers:
- name: Watchdog
webhook_configs:
- url: https://my.watchdog.webhook.url
# Other things
This is Alert Manager config.
I am answering my question after some time and probably this issue with the Prometheus Operator CRD is fixed by now.