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

Update PodMonitor for kube-proxy #1630

Merged
merged 1 commit into from
Feb 16, 2022

Conversation

philipgough
Copy link
Contributor

Description

The default PodMonitor that was shipped for kube-proxy was causing the target to never appear, and in SD, the target labels appeared as Dropped.

Screenshot 2022-02-09 at 12 54 39

Because the PodMonitor has targetPort set, prometheus-operator is adding relabelling with action: keep which causes discovered targets to be kept, only if the regex matches a source label and since the DaemonSet for kube-proxy has no ports defined, we dont have __meta_kubernetes_pod_container_port_name label, and Prometheus doesn't have anything to match, so it discards the target.

/~https://github.com/prometheus-operator/prometheus-operator/blob/main/pkg/prometheus/promcfg.go#L745-L750

This is why the fix suggested in #1603 (comment) actually works.

Screenshot of targets up after this fix is applied:

Screenshot 2022-02-10 at 11 08 18

Thanks @paulfantom for help investigating the solution.

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
If it fixes a bug or resolves a feature request, be sure to link to that issue.

Fixes #1603

Type of change

What type of changes does your code introduce to the kube-prometheus? Put an x in the box that apply.

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Changelog entry

Please put a one-line changelog entry below. Later this will be copied to the changelog file.

Add __address__ relabelling for kube-proxy PodMonitor to stop target being dropped

Copy link
Member

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

Tested the setup on a local KinD cluster and confirmed it works as expected 👍

@paulfantom paulfantom merged commit 5ff20b1 into prometheus-operator:main Feb 16, 2022
@yogeek
Copy link

yogeek commented Apr 8, 2022

Just had this issue with release-0.9 and finally found your fix : thank you ! But this was only merged into main...
Is it possible to backport this fix to 0.9 and 0.10 please ? (as this podmonitor has been added in 0.9 apparently)
@paulfantom

@paulfantom
Copy link
Member

@yogeek yes, it is possible, are you willing to give it a try?

@yogeek
Copy link

yogeek commented Apr 8, 2022

@paulfantom thank your for your quick reply.
Yes I am going to try !

@yogeek
Copy link

yogeek commented Apr 8, 2022

@paulfantom here are the PRs :

Hope it is all right !

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

Successfully merging this pull request may close these issues.

Prometheus is not Monitoring kube-proxy
4 participants