I installed Istio default with --set values.prometheus.enabled=true, which worked fine, but I wanted to move to a production configuration.
So I reinstalled Istio without Prometheus, and installed the kube-prometheus stack (head).
There is a section in the Istio documentation for using Istio with an existing Prometheus
I have to add some scraping configuration somewhere, but not sure what to add and where.
The only prometheus configmap I have is prometheus-k8s-rulefiles-0.
The Prometheus Operator documentation says I should add ServiceMonitors.
Are there ready-to-use ServiceMonitors for the Istio Control and Data plane, or instruction how to make them?
Ideally, an IstioCtl option to install Prometheus ServiceMonitors would be great.
here is what i have for 1.5 istio, you may need to adjust this for 1.7 but it should at least give you some idea on scraping control plane and data plane
I found some (parts of) examples in different places, and combined them to make it work.
I created a ServiceMonitor for the Istio components, and a PodMonitor for my application pods that I want to monitor and see in Kiali. The monitors are in the monitoring namespace. Furthermore I created a ClusterRole to have the necessary access to other namespaces.
I will add the yaml files below. Note that the ServiceMonitor matchExpression can be simpler, because 1.7 just has one pod. I think you can just match on pilot.
The PodMonitor just select the default namespace. These are things that should be easy to change, but I didn’t get around to it yet. I don’t know what the relabelings are for and if they are needed. I you find out please let me know.