goharbor / harbor-helm

The helm chart to deploy Harbor
Apache License 2.0
1.17k stars 758 forks source link

Harbor metrics exporter #1798

Open tnubeo1111 opened 1 month ago

tnubeo1111 commented 1 month ago

Hello team,

Currently I am setting up harbor version 2.11.0 using helm but now I want to enable harbor metrics and transfer metrics to another prometheus server, what should I do? I followed the docs but it still doesn't work

Hope the team can help.

Kajot-dev commented 1 month ago

You need to provide more info. How did you deploy it, where, what did you try?

tnubeo1111 commented 1 month ago

Thank you for responding.

Currently I have installed and configured Harbor (v2.11.0) using helm in a k8s cluster that specializes in providing services on it.

Next there is a k8s cluster that specializes in monitoring.

Then I went to the harbor's values ​​file to configure metrics.enable=true to configure metrics. But I see that it is currently configuring port 8001 and the path is /metrics, which means it is active in pods. If I want to see the harbor's metrics, I have to build an additional prometheus in the harbor's k8s cluster to see it.

But now that I have built a prometheus in a completely different cluster from the harbor, can I ask if there is a way for a prometheus in another cluster to get the metrics of the harbor?

I just have an idea to create a new service about NodePort and then add the labels of the exporter app.kubernetes.io/component: exporter, I don't know if that's possible.

Kajot-dev commented 1 month ago

You would need to expose it somehow. Either via separate Ingress (since Ingress only listens on http/s) or via NodePort/Loadbalancer service.

Although sending metric between the clusters does not make much sense to me, escpecially from the security standpoint. It would be much better to for example use Prometheus Operator which provides neat CRD like ServiceMonitor, PrometheusRule just for that + AlertManager for notifications