From 3427e194abdd916453185ff63a98cc0db6576858 Mon Sep 17 00:00:00 2001 From: Rafael Laszlo <rlacko99@gmail.com> Date: Sat, 20 Nov 2021 21:23:37 +0100 Subject: [PATCH] Add istio monitoring config --- .../istio-components-serviceMonitor.yaml | 21 ++++++++++ .../istio-envoy-stats-serviceMonitor.yaml | 39 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 ansible/k8s/components/monitoring/components/istio/istio-components-serviceMonitor.yaml create mode 100644 ansible/k8s/components/monitoring/components/istio/istio-envoy-stats-serviceMonitor.yaml diff --git a/ansible/k8s/components/monitoring/components/istio/istio-components-serviceMonitor.yaml b/ansible/k8s/components/monitoring/components/istio/istio-components-serviceMonitor.yaml new file mode 100644 index 0000000..b5d6939 --- /dev/null +++ b/ansible/k8s/components/monitoring/components/istio/istio-components-serviceMonitor.yaml @@ -0,0 +1,21 @@ +# https://github.com/istio/istio/blob/master/samples/addons/extras/prometheus-operator.yaml + +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: istio-components + namespace: istio-system + labels: + monitoring: istio-components + release: istio +spec: + jobLabel: istio + targetLabels: [app] + selector: + matchExpressions: + - {key: istio, operator: In, values: [pilot]} + namespaceSelector: + any: true + endpoints: + - port: http-monitoring + interval: 15s \ No newline at end of file diff --git a/ansible/k8s/components/monitoring/components/istio/istio-envoy-stats-serviceMonitor.yaml b/ansible/k8s/components/monitoring/components/istio/istio-envoy-stats-serviceMonitor.yaml new file mode 100644 index 0000000..f4c402b --- /dev/null +++ b/ansible/k8s/components/monitoring/components/istio/istio-envoy-stats-serviceMonitor.yaml @@ -0,0 +1,39 @@ +# https://github.com/istio/istio/blob/master/samples/addons/extras/prometheus-operator.yaml + +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: istio-envoy-stats + namespace: istio-system + labels: + monitoring: istio-proxies + release: istio +spec: + selector: + matchExpressions: + - {key: istio-prometheus-ignore, operator: DoesNotExist} + namespaceSelector: + any: true + jobLabel: envoy-stats + podMetricsEndpoints: + - path: /stats/prometheus + interval: 15s + relabelings: + - action: keep + sourceLabels: [__meta_kubernetes_pod_container_name] + regex: "istio-proxy" + - action: keep + sourceLabels: [__meta_kubernetes_pod_annotationpresent_prometheus_io_scrape] + - sourceLabels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port] + action: replace + regex: ([^:]+)(?::\d+)?;(\d+) + replacement: $1:$2 + targetLabel: __address__ + - action: labeldrop + regex: "__meta_kubernetes_pod_label_(.+)" + - sourceLabels: [__meta_kubernetes_namespace] + action: replace + targetLabel: namespace + - sourceLabels: [__meta_kubernetes_pod_name] + action: replace + targetLabel: pod_name -- GitLab