karmada-io / dashboard

Web UI for Karmada
Apache License 2.0
44 stars 39 forks source link

Reading Karmada Metrics #73

Closed axif0 closed 1 week ago

axif0 commented 1 month ago

Please provide an in-depth description of the question you have:

Based on here I manage to find these metrics with your help here . When debugging i tried

kubectl` --kubeconfig ~/.kube/karmada.config --context karmada-host get --raw `/api/v1/namespaces/karmada-system/pods/${pod_name}:8080/proxy/metrics . it show all the available metrics results in karmada-host. But I failed to find all metrics.

image

How can I get other metrics results to show on dashboard? Can you please give me suggestion? @warjiang

Environment:

Karmada version: latest Karmada Dashboard version: 0.1.0 Others: N/A

warjiang commented 3 weeks ago

@axif0 sorry late for the reply. Thanks for your enthusiasm first. The way to fetch metcis you metioned above only can fetch metrics from karmada-controller-manager. In fact, the metrics spread in many karmada components across control plane and member cluser(for pull mode only). I'll provide a more detailed document here and under the lfx issue(I'm try my best to translate the doc 🚀 ).

axif0 commented 3 weeks ago

So, based on this, using,

kubectl --kubeconfig ~/.kube/karmada.config --context karmada-host get pods -n karmada-system -l app=karmada-scheduler -o jsonpath='{.items[1].metadata.name}'
pod_name=karmada-scheduler-7bd4659f9f-s2mzv
kubectl --kubeconfig ~/.kube/karmada.config --context karmada-host get --raw /api/v1/namespaces/karmada-system/pods/${pod_name}:10351/proxy/metrics | grep 'schedule_attempts_total'

I got the schedule_attempts_total. Thank you, @warjiang

Any suggestion regarding auto selecting master pod? Because i'll have to always check for jsonpath='{.items[1].metadata.name} or jsonpath='{.items[0].metadata.name} in command for which pod is the master pod.