Is there a way to configure prometheus to ignore scraping metrics for all the resources belonging to a particular namespace? I am not able to figure it out by reading the documentation.
You can drop targets with relabel_config
by using drop
action. From the documentation:
drop
: Drop targets for whichregex
matches the concatenatedsource_labels
.
Example:
relabel_configs:
# This will ignore scraping targets from 'ignored_namespace_1',
# 'ignored_namespace_2', and 'ignored_namespace_N'.
- source_labels: [__meta_kubernetes_namespace]
action: drop
regex: ignored_namespace_1|ignored_namespace_2|ignored_namespace_N