From 9088fad25e5cc433f0b8316ebdedacbe2400f841 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 10 Jul 2024 15:57:09 -0700 Subject: [PATCH] enable k8s scraping by annotation servicemonitors are too hard --- k8s/operators/kube-prometheus/cluster-role-patch.yaml | 6 ++++++ k8s/operators/kube-prometheus/kustomization.yaml | 10 ++++++++++ k8s/operators/kube-prometheus/prometheus-patch.yaml | 9 +++++++++ 3 files changed, 25 insertions(+) create mode 100644 k8s/operators/kube-prometheus/cluster-role-patch.yaml create mode 100644 k8s/operators/kube-prometheus/prometheus-patch.yaml diff --git a/k8s/operators/kube-prometheus/cluster-role-patch.yaml b/k8s/operators/kube-prometheus/cluster-role-patch.yaml new file mode 100644 index 0000000..bebdefe --- /dev/null +++ b/k8s/operators/kube-prometheus/cluster-role-patch.yaml @@ -0,0 +1,6 @@ +- op: add + path: /rules/- + value: + apiGroups: [""] + resources: [pods] + verbs: [list, get, watch] diff --git a/k8s/operators/kube-prometheus/kustomization.yaml b/k8s/operators/kube-prometheus/kustomization.yaml index ccd693d..a05321c 100644 --- a/k8s/operators/kube-prometheus/kustomization.yaml +++ b/k8s/operators/kube-prometheus/kustomization.yaml @@ -24,3 +24,13 @@ patches: target: kind: NetworkPolicy name: alertmanager-main + + - path: prometheus-patch.yaml + target: + kind: Prometheus + name: k8s + + - path: cluster-role-patch.yaml + target: + kind: ClusterRole + name: prometheus-k8s diff --git a/k8s/operators/kube-prometheus/prometheus-patch.yaml b/k8s/operators/kube-prometheus/prometheus-patch.yaml new file mode 100644 index 0000000..79f1bc3 --- /dev/null +++ b/k8s/operators/kube-prometheus/prometheus-patch.yaml @@ -0,0 +1,9 @@ +- op: add + path: /spec/additionalScrapeConfigs + value: + key: scrape-configs.yaml + name: additional-scrape-configs + optional: true +- op: add + path: /spec/secrets + value: [scrape-secrets]