Hi Javier, You can use podTemplate to expose the port in the flink containers. Here is a snippet: spec: flinkVersion: v1_15 flinkConfiguration: state.savepoints.dir: file:///flink-data/flink-savepoints state.checkpoints.dir: file:///flink-data/flink-checkpoints metrics.reporter.prom.factory.class: org.apache.flink.metrics.prometheus.PrometheusReporterFactory serviceAccount: flink podTemplate: metadata: annotations: prometheus.io/path: /metrics prometheus.io/port: "9249" prometheus.io/scrape: "true" spec: serviceAccount: flink containers: - name: flink-main-container volumeMounts: - mountPath: /flink-data name: flink-volume ports: - containerPort: 9249 name: metrics protocol: TCP volumes: - name: flink-volume emptyDir: {}
The bold line are about how to specify the metric reporter and expose the metric. The annotations are not required if you use PodMonitor or ServiceMonitor. Hope it can help! Best, Biao Geng From: Javier Vegas <jve...@strava.com> Date: Sunday, September 4, 2022 at 10:19 AM To: user <user@flink.apache.org> Subject: How to open a Prometheus metrics port on the rest service when using the Kubernetes operator? I am migrating my Flink app from standalone Kubernetes to the Kubernetes operator, it is going well but I ran into a problem, I can not figure out how to open a Prometheus metrics port in the rest-service to collect all my custom metrics from the task managers. Note that this is different from the instructions to "How to Enable Prometheus" https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-main/docs/operations/metrics-logging/#how-to-enable-prometheus-example that example is to collect the operator pod metrics, but what I am trying to do is open a port on the rest service to make my job metrics available to Prometheus. Thanks, Javier Vegas