TL; DR: some prometheus exporters such as kube-state-metrics do emit a LOT of metrics and that will make a difference in your next bill so here’s how to drop them.
apiVersion: monitoring.googleapis.com/v1
kind: PodMonitoring
metadata:
name: my-app-monitoring
spec:
endpoints:
- interval: 1m
metricRelabeling:
# drop is the action!
- action: drop
# a regex to match all metrics to be dropped
regex: unwanted_metric_prefix-.*
# to match against the name of the metric
sourceLabels:
- __name__
path: /metrics
port: 8080
selector:
matchLabels:
app: my-app
🙂
