<p>After applying these manifests <a href="https://github.com/prometheus-operator/kube-prometheus/blob/main/kustomization.yaml" rel="nofollow noreferrer">https://github.com/prometheus-operator/kube-prometheus/blob/main/kustomization.yaml</a> I want to create <code>AlertManager</code> webhook:</p>
<pre><code>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
</code></pre>
<p>getting an error:</p>
<p><code>error: error validating &quot;alertmanagerconfig.yaml&quot;: error validating data: ValidationError(AlertmanagerConfig.spec.receivers[0]): unknown field &quot;webhook_configs&quot; in com.coreos.monitoring.v1alpha1.AlertmanagerConfig.spec.receivers; if you choose to ignore these errors, turn validation off with --validate=false</code></p>
<p>How to fix that?</p>

<p>The problem is that you are using the configuration reference for the actual AlertManager application and not the one for the Kubernetes Custom Resource provided by the Prometheus Operator.</p>
<p>The Prometheus Operator takes the configuration provided in the form of custom resources like AlertManagerConfig and converts them into actual AlertManager config and updates the configuration file the application uses. That is a part of the reason why you use an operator in the first place. It makes these things convenient for you.</p>
<p>So the actual configuration reference you should be using here is <a href="https://docs.openshift.com/container-platform/4.7/rest_api/monitoring_apis/alertmanagerconfig-monitoring-coreos-com-v1alpha1.html" rel="nofollow noreferrer">this</a>.
This <a href="https://github.com/prometheus-operator/prometheus-operator#customresourcedefinitions" rel="nofollow noreferrer">part</a> of the Prometheus Operator's github readme lists down the available custom resources you can use with it.</p>
