Enabling alert routing for user-defined projects

    • Enable alert routing for user-defined projects to use the default platform Alertmanager instance or, optionally, a separate Alertmanager instance only for user-defined projects.

    • Grant users permission to configure alert routing for user-defined projects.

    After you complete these steps, developers and other users can configure custom alerts and alert routing for their user-defined projects.

    As a cluster administrator, you can enable alert routing for user-defined projects. With this feature, you can allow users with the alert-routing-edit role to configure alert notification routing and receivers for user-defined projects. These notifications are routed by the default Alertmanager instance or, if enabled, an optional Alertmanager instance dedicated to user-defined monitoring.

    Users can then create and configure user-defined alert routing by creating or editing the objects for their user-defined projects without the help of an administrator.

    After a user has defined alert routing for a user-defined project, user-defined alert notifications are routed as follows:

    • To the alertmanager-main pods in the openshift-monitoring namespace if using the default platform Alertmanager instance.

    • To the alertmanager-user-workload pods in the openshift-user-workload-monitoring namespace if you have enabled a separate instance of Alertmanager for user-defined projects.

    You can allow users to create user-defined alert routing configurations that use the main platform instance of Alertmanager.

    Prerequisites

    • You have installed the OpenShift CLI (oc).

    Procedure

    1. Edit the cluster-monitoring-config ConfigMap object:

    2. Add enableUserAlertmanagerConfig: true in the alertmanagerMain section under data/config.yaml:

      1. apiVersion: v1
      2. metadata:
      3. name: cluster-monitoring-config
      4. namespace: openshift-monitoring
      5. config.yaml: |
      6. alertmanagerMain:
      7. enableUserAlertmanagerConfig: true (1)
    3. Save the file to apply the changes.

    In some clusters, you might want to deploy a dedicated Alertmanager instance for user-defined projects, which can help reduce the load on the default platform Alertmanager instance and can better separate user-defined alerts from default platform alerts. In these cases, you can optionally enable a separate instance of Alertmanager to send alerts for user-defined projects only.

    Prerequisites

    • You have access to the cluster as a user with the cluster-admin role.

    • You have enabled monitoring for user-defined projects in the cluster-monitoring-config config map for the openshift-monitoring namespace.

    • You have installed the OpenShift CLI (oc).

    Procedure

    1. Edit the user-workload-monitoring-config ConfigMap object:

    2. Add enabled: true and enableAlertmanagerConfig: true in the alertmanager section under data/config.yaml:

      1. apiVersion: v1
      2. kind: ConfigMap
      3. metadata:
      4. data:
      5. config.yaml: |
      6. alertmanager:
      7. enabled: true (1)
      8. enableAlertmanagerConfig: true (2)

    Verification

    • Verify that the user-workload Alertmanager instance has started:

      Example output

      1. NAME VERSION REPLICAS AGE
      2. user-workload 0.24.0 2 100s

    You can grant users permission to configure alert routing for user-defined projects.

    Prerequisites

    • You have access to the cluster as a user with the cluster-admin role.

    • The user account that you are assigning the role to already exists.

    • You have installed the OpenShift CLI (oc).

    • You have enabled monitoring for user-defined projects.

    Procedure

    • Assign the alert-routing-edit role to a user in the user-defined project:

    Additional resources