Search code examples
prometheus-alertmanager

Prometheus Slack alerts unknown field "slack_configs" in com.coreos.monitoring.v1alpha1.AlertmanagerConfig.spec.receivers


When configuring Slack Alerts in AlertmanagerConfig, I am getting following error (when releasing helm chart on Kubernetes cluster)

Error: UPGRADE FAILED: error validating "": error validating data: ValidationError(AlertmanagerConfig.spec.receivers[0]): unknown field "slack_configs" in com.coreos.monitoring.v1alpha1.AlertmanagerConfig.spec.receivers

My alertmanagerconfig.yaml file looks as follows:

apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  name: {{ template "theresa.fullname" . }}-alertmanager-config
  labels:
    alertmanagerConfig: email-notifications
spec:
  route:
    receiver: 'slack-email'

  receivers:
  - name: 'slack-email'
    slack_configs:
      - channel: '#cmr-orange-alerts'
        api_url: ..
        send_resolved: true
        icon_url: ..
        title: "{{ range .Alerts }}{{ .Annotations.summary }}\n{{ end }}"
        text: ..

Solution

  • You are trying to create a k8s resource of kind: AlertmanagerConfig but use the syntax of Prometheus config file, not a resource's syntax.

    Check the syntax here: https://docs.openshift.com/container-platform/4.7/rest_api/monitoring_apis/alertmanagerconfig-monitoring-coreos-com-v1alpha1.html