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

[kube-prometheus-stack] - targetLabels for all exporters #4973

Merged

Conversation

kranthikirang
Copy link
Contributor

What this PR does / why we need it

This PR will add the support for targetLabels for all exporters in kube-prometheus-stack

Which issue this PR fixes

Signed-off-by: kranthikirang <kranthi.guttikonda9@gmail.com>
@jkroepke
Copy link
Member

jkroepke commented Nov 5, 2024

Basically, if you want to monitor using federated prometheus we need to have support for additional targetLabels to distinguish among clusters.

In our cases, we modified the serviceMonitor relabel config directly via values and add a cluster label everywhere.

  kubelet:
    namespace: opsstack
    serviceMonitor:
      relabelings:
        - action: replace
          sourceLabels: [__metrics_path__]
          targetLabel: metrics_path
        - targetLabel: cluster
          replacement: opsstack
      cAdvisorRelabelings:
        - action: replace
          sourceLabels: [__metrics_path__]
          targetLabel: metrics_path
        - targetLabel: cluster
          replacement: opsstack
      probesRelabelings:
        - action: replace
          sourceLabels: [__metrics_path__]
          targetLabel: metrics_path
        - targetLabel: cluster
          replacement: opsstack
      resourceRelabelings:
        - action: replace
          sourceLabels: [__metrics_path__]
          targetLabel: metrics_path
        - targetLabel: cluster
          replacement: opsstack

Signed-off-by: kranthikirang <kranthi.guttikonda9@gmail.com>
Signed-off-by: kranthikirang <kranthi.guttikonda9@gmail.com>
Signed-off-by: kranthikirang <kranthi.guttikonda9@gmail.com>
Copy link
Member

@jkroepke jkroepke left a comment

Choose a reason for hiding this comment

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

LGTM.

I found one thing and please add a test case for the extra arg here:

You can use the example from the values.yaml.

Once done, I fine to merge it.

Signed-off-by: kranthikirang <kranthi.guttikonda9@gmail.com>
@kranthikirang
Copy link
Contributor Author

@jkroepke Can you please check now?

…loyment.yaml

Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
Copy link
Member

@jkroepke jkroepke left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@jkroepke jkroepke merged commit 686ceff into prometheus-community:main Nov 5, 2024
4 checks passed
@kranthikirang kranthikirang deleted the kubelet_tagetLabels#4966 branch November 5, 2024 21:48
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-kube-stack - support targetLabels for node-exporter and kubelet using operator
2 participants