Top
Enterprise Postgres 18 for Kubernetes User's Guide

E.3.2 Create a ServiceMonitor

To automatically configure Prometheus to scrape metrics from the Fluent Bit service, you'll need to create a `ServiceMonitor` resource. This is particularly useful in Kubernetes environments that use the Prometheus Operator.

Sample YAML file for Create a ServiceMonitor:

   apiVersion: monitoring.coreos.com/v1
   kind: ServiceMonitor
   metadata:
     name: <serviceMonitor-name>
     namespace: <namespace>
     labels:
       release: prometheus
   spec:
     selector:
       matchLabels:
         app: <fluent-bit-pod-name>
         fepclustername: <fepcluster-name>
     endpoints:
       - port: prometheus-metrics
         path: /metrics
         interval: 15s
     namespaceSelector:
       matchNames: <namespace>