From d86d651c4f09bec0d936f228874f1e670ab432ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beatrice=20Dellac=C3=A0?= Date: Sun, 30 Mar 2025 19:34:16 +0200 Subject: [PATCH] Revert "fix prometheus" This reverts commit a3d3dd8336d6667c1f8b889bb0e10c5416a7f318. --- deploy/keycloak/keycloak.yaml | 4 ++-- deploy/prometheus/deploy.jsonnet | 20 ++----------------- .../manifests/prometheus-networkPolicy.yaml | 6 +++++- .../manifests/prometheus-prometheus.yaml | 5 +---- .../manifests/prometheus-service.yaml | 6 +++++- 5 files changed, 15 insertions(+), 26 deletions(-) diff --git a/deploy/keycloak/keycloak.yaml b/deploy/keycloak/keycloak.yaml index 9a231ec..5a52957 100644 --- a/deploy/keycloak/keycloak.yaml +++ b/deploy/keycloak/keycloak.yaml @@ -114,13 +114,13 @@ spec: httpGet: path: /health/live port: 9000 # Use management port for liveness - initialDelaySeconds: 60 + initialDelaySeconds: 90 periodSeconds: 30 readinessProbe: httpGet: path: /health/ready port: 9000 # Use management port for readiness - initialDelaySeconds: 30 + initialDelaySeconds: 60 periodSeconds: 15 affinity: # Spread pods across different nodes for higher availability diff --git a/deploy/prometheus/deploy.jsonnet b/deploy/prometheus/deploy.jsonnet index 4ed8079..1ede903 100644 --- a/deploy/prometheus/deploy.jsonnet +++ b/deploy/prometheus/deploy.jsonnet @@ -9,7 +9,7 @@ local kp = (import 'kube-prometheus/main.libsonnet') + { // Disable the built-in Grafana component grafana+:: {}, - // Prometheus customizations: external URL, persistent storage, and self-scrape enabled + // Prometheus customizations: external URL and persistent storage prometheus+:: { prometheus+: { spec+: { @@ -24,22 +24,6 @@ local kp = (import 'kube-prometheus/main.libsonnet') + { }, }, }, - // Enable self-scraping so Prometheus will automatically scrape its own /metrics endpoint - selfScrape: true, - // Set a ServiceMonitor selector that matches the Prometheus service's labels - serviceMonitorSelector: { - matchLabels: { - "k8s-app": "prometheus", - }, - }, - }, - }, - // Ensure the Prometheus service gets the label so that the selector above matches it - service+: { - metadata+: { - labels: { - "k8s-app": "prometheus", - }, }, }, }, @@ -143,4 +127,4 @@ local kp = (import 'kube-prometheus/main.libsonnet') + { { ['node-exporter-' + name]: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } + { ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } + { ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } + -{ [name + '-ingress']: kp.ingress[name] for name in std.objectFields(kp.ingress) } \ No newline at end of file +{ [name + '-ingress']: kp.ingress[name] for name in std.objectFields(kp.ingress) } diff --git a/deploy/prometheus/manifests/prometheus-networkPolicy.yaml b/deploy/prometheus/manifests/prometheus-networkPolicy.yaml index bbe7a43..fa5d86c 100644 --- a/deploy/prometheus/manifests/prometheus-networkPolicy.yaml +++ b/deploy/prometheus/manifests/prometheus-networkPolicy.yaml @@ -2,7 +2,11 @@ apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: labels: - k8s-app: prometheus + app.kubernetes.io/component: prometheus + app.kubernetes.io/instance: k8s + app.kubernetes.io/name: prometheus + app.kubernetes.io/part-of: kube-prometheus + app.kubernetes.io/version: 3.2.1 name: prometheus-k8s namespace: monitoring spec: diff --git a/deploy/prometheus/manifests/prometheus-prometheus.yaml b/deploy/prometheus/manifests/prometheus-prometheus.yaml index 3575f03..e5108c1 100644 --- a/deploy/prometheus/manifests/prometheus-prometheus.yaml +++ b/deploy/prometheus/manifests/prometheus-prometheus.yaml @@ -46,12 +46,9 @@ spec: fsGroup: 2000 runAsNonRoot: true runAsUser: 1000 - selfScrape: true serviceAccountName: prometheus-k8s serviceMonitorNamespaceSelector: {} - serviceMonitorSelector: - matchLabels: - k8s-app: prometheus + serviceMonitorSelector: {} storage: volumeClaimTemplate: spec: diff --git a/deploy/prometheus/manifests/prometheus-service.yaml b/deploy/prometheus/manifests/prometheus-service.yaml index 5e3005c..3efceb4 100644 --- a/deploy/prometheus/manifests/prometheus-service.yaml +++ b/deploy/prometheus/manifests/prometheus-service.yaml @@ -2,7 +2,11 @@ apiVersion: v1 kind: Service metadata: labels: - k8s-app: prometheus + app.kubernetes.io/component: prometheus + app.kubernetes.io/instance: k8s + app.kubernetes.io/name: prometheus + app.kubernetes.io/part-of: kube-prometheus + app.kubernetes.io/version: 3.2.1 name: prometheus-k8s namespace: monitoring spec: