Is there a way to open ports for Prometheus to scrape? #114
Comments
Thanks for the proposal! I need to do some research first. If you have more detailed ideas, we can discuss here. |
@afilipchik Does this work for you? I think you might need to build a custom image and specify related Flink properties in the CR. I don't see any change needed in the operator. |
@afilipchik Check https://github.com/ChethanUK/Flink_Docker/blob/master/Dockerfile to build a custom image and then In job-manager-service, I add the following lines: annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9999" |
@chethanuk Thanks for your image, but why are the annotations needed for JM service? |
I thought the operator will need to open appropriate port (in the generated yaml), so the scraper can reach the container. Currently only flink related ports are exposed. For now I did build a custom image and used prometheus push gateway, but having direct scrape sound more appropriate. |
@afilipchik right, I think we can expose a prometheus port (9999 by default) on JM and TMs. |
I realized the hard part is that, Prometheus needs to distinguish each TM, e.g.
that makes it hard for Kubernetes, because we cannot simply create a TM service which is backed by all TMs. The doc says:
I need to do more research on this. |
I believe Prometheus can discover scrape targets (no need to hardcode them in the config). Target just needs to be accessible.
|
Prometheus also supports pod discovery. Using this method, prometheus queries the k8s api with pod meta information - labels and annotations - to get pod IPs and scrapes directly with those IPs. Note: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#pod To support this approach we need to map the exporter port to the pod and allow the pod's label and annotation to be set. In this case metric collection is possible without any services. |
No description provided.
The text was updated successfully, but these errors were encountered: