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

How to confirm MetricsEndpoints (port and path) for Karmada components with ServiceMonitor or PodMonitor? #5955

Open
weidalin opened this issue Dec 14, 2024 · 6 comments
Labels
kind/question Indicates an issue that is a support question.

Comments

@weidalin
Copy link

weidalin commented Dec 14, 2024

Please provide an in-depth description of the question you have:
According to the documentation (Karmada Metrics Reference), Karmada provides many useful metrics.

  1. I am trying to use PodMonitor to scrape metrics exposed by the karmada-controller-manager and karmada-scheduler components in my Karmada environment. However, I am unsure about the correct port and path values for the podMetricsEndpoints field.

Here is an example of my PodMonitor configuration:

apiVersion: monitoring.coreos.com/v1  
kind: PodMonitor  
metadata:  
  name: karmada-controller-manager-monitor  
  namespace: monitoring  
spec:  
  selector:  
    matchLabels:  
      app: karmada-controller-manager  
  namespaceSelector:  
    matchNames:  
      - karmada-system  
  podMetricsEndpoints:  
    - port: metrics  
      path: /metrics  
      interval: 30s  

I have referred to the Karmada Metrics documentation, but the specific port and path settings are not clearly mentioned. Could you confirm the correct values for these fields?

  1. Besides configuring ServiceMonitor or PodMonitor, is there any additional configuration required to scrape metrics from Karmada?

What do you think about this question?
Clear documentation or guidelines on the correct port and path for metrics scraping would be very helpful, especially for integrating with Prometheus.

Environment:

Karmada version: 1.10.4
Kubernetes version: v1.27.x
Others: The Karmada cluster already has Prometheus installed and running. @zhzhuang-zju

@weidalin weidalin added the kind/question Indicates an issue that is a support question. label Dec 14, 2024
@weidalin weidalin changed the title Title: How to confirm MetricsEndpoints (port and path) for Karmada components with ServiceMonitor or PodMonitor? How to confirm MetricsEndpoints (port and path) for Karmada components with ServiceMonitor or PodMonitor? Dec 14, 2024
@zhzhuang-zju
Copy link
Contributor

@weidalin In release v1.11.0, Karmada defined metrices port name in container field of related karmada components, so that the port name can be specified in PodMonitor to form prothumes metrics dashboard. More info can refer to #5166

@zhzhuang-zju
Copy link
Contributor

Are you using Karmada version v1.10.4?

@weidalin
Copy link
Author

Are you using Karmada version v1.10.4?

Yes. Do I have to upgrade to v1.11.0 to use PodMonitor?
If I don't use PodMonitor, is there any other way to import data into Prometheus? @zhzhuang-zju

@zhzhuang-zju
Copy link
Contributor

Yes. Do I have to upgrade to v1.11.0 to use PodMonitor?

If you do not wish to upgrade, you can also define the metrics name in the manifest of the related components according to #5166.

If I don't use PodMonitor, is there any other way to import data into Prometheus? @zhzhuang-zju

How about extraScrapeConfigs? It can add additional scrape configurations to the Prometheus instance.

@LavredisG
Copy link
Contributor

I for one use this values.yaml file to scrape karmada-controller-manager for example:

prometheus:
  prometheusSpec:
    additionalScrapeConfigs:
      - job_name: 'karmada_metrics'
        scrape_interval: 30s
        static_configs:
          - targets:
            - '<karmada-controller-manager-IP>:8080'

Replace with your controller IP. I use the prometheus helm chart, so when installing it you have to apply this as:

helm install prometheus prometheus-community/kube-prometheus-stack -f values.yaml

Hope it helps!

@zhzhuang-zju
Copy link
Contributor

@weidalin Hello, has your problem been resolved? If so, could you share your solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Indicates an issue that is a support question.
Projects
None yet
Development

No branches or pull requests

3 participants