Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The default PodMonitor that was shipped for
kube-proxy
was causing the target to never appear, and in SD, the target labels appeared asDropped
.Because the PodMonitor has
targetPort
set, prometheus-operator is adding relabelling withaction: keep
which causes discovered targets to be kept, only if the regex matches a source label and since the DaemonSet forkube-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:
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.