Filtering Alert Manager Alerts with Kubernetes Namespaces

Viewed 124

As of Now, We have Promethues and Alert Manager configured in K8's cluster and the alerts are getting pushed to slack channel.

In our K8's Cluster, Dynamically Few Namespaces gets Created and pods will be launched.

Can we disable the slack alert notifications from the pods which are dynamically created in the namespaces?

1 Answers

As @Sergio Santiago mentioned adding more points to the below answer

If there's something about the dynamic namespaces like a prefix you can match with a regex then you can use the matchers config to route those alerts to null matchers and this can match against any label on the alert so that should be possible

your alertmanager config would have some config that looks like this (an example if your dynamic namespaces all look like dynamic-foo dynamic-bar, etc and you want to route those alerts to null)

Here is an example:

 routes:

 - matchers:
    - namespace =~ "dynamic-.*"
   receiver: null

you'll need to make sure you have a label matching that syntax so there is a nice tool for visualizing and testing your config here:

Related