Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use custom ServiceMonitor for Prometheus' own metrics #2238

Merged
merged 1 commit into from
Apr 19, 2022

Conversation

andrzej-stencel
Copy link
Contributor

Having the kube-prometheus-stack subchart generate the ServiceMonitor to scrape Prometheus' own metrics does not work correctly in a setup with an external Prometheus operator in a different (higher) version.
By "does not work correctly" I mean that the ServiceMonitor points to a Service that does not see any pods and in effect, Prometheus cannot scrape its own metrics.
This is because different versions of Prometheus operator create different labels on Prometheus pods.
To fix this, let's disable the kube-prometheus-stack subchart's built-in ServiceMonitor and create our own, just like we do for other collection resources (Fluent Bit, Fluentd, Otelcol).

@andrzej-stencel andrzej-stencel requested a review from a team as a code owner April 14, 2022 14:13
@andrzej-stencel andrzej-stencel force-pushed the custom-prometheus-servicemonitor branch from d2a0aab to da47bdc Compare April 14, 2022 14:16
@github-actions github-actions bot added the documentation documentation label Apr 14, 2022
Having the `kube-prometheus-stack` subchart generate the ServiceMonitor to scrape Prometheus' own metrics does not work correctly in a setup with an external Prometheus operator in a different (higher) version.
By "does not work correctly" I mean that the ServiceMonitor points to a Service that does not see any pods and in effect, Prometheus cannot scrape its own metrics.
This is because different versions of Prometheus operator create different labels on Prometheus pods.
To fix this, let's disable the `kube-prometheus-stack` subchart's built-in ServiceMonitor and create our own, just like we do for other collection resources (Fluent Bit, Fluentd, Otelcol).
@andrzej-stencel andrzej-stencel force-pushed the custom-prometheus-servicemonitor branch from da47bdc to 9c92368 Compare April 14, 2022 14:18
@andrzej-stencel andrzej-stencel modified the milestone: v2.8 Apr 14, 2022
Copy link

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add these metrics to

so integration tests verify their presence?

@andrzej-stencel andrzej-stencel merged commit 3cb0773 into main Apr 19, 2022
@andrzej-stencel andrzej-stencel deleted the custom-prometheus-servicemonitor branch April 19, 2022 14:02
@andrzej-stencel
Copy link
Contributor Author

andrzej-stencel commented Apr 19, 2022

Can you add these metrics to


so integration tests verify their presence?

I was getting failures trying to run integration tests locally (even without any changes). Let's discuss it separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants