I would like to get prometheus alerts only for the namespaces that I deploy and exclude those ones from default namespaces like kube-system . Could some one help me how to achieve this
You could just exclude the namespaces from which alerts are not needed in expr
of your alert_rule
, for example:
...
alert: you_alert_name
expr: sum(kube_pod_init_container_status_restarts_total{namespace!~"kube-public|kube-system|default|..."}[10s]) > 5
...