The prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false option allows Prometheus Operator to watch serviceMonitors outside of its namespace.
Install Flagger by setting the metrics server to Prometheus:
The demo app is instrumented with Prometheus, so you can create a ServiceMonitor objects to scrape podinfo's metrics endpoint:
We are setting interval: 5s to have a more aggressive scraping. If you do not define it, you should use a longer interval in the Canary object.
Metric templates
Create a metric template to measure the HTTP requests error rate:
Create a metric template to measure the HTTP requests average duration:
Canary analysis
Using the metrics template you can configure the canary analysis with HTTP error rate and latency checks:
Based on the above specification, Flagger creates the primary and canary Kubernetes ClusterIP service.
During the canary analysis, Prometheus will scrape the canary service and Flagger will use the HTTP error rate and latency queries to determine if the release should be promoted or rolled back.