diff --git a/deploy/keycloak/keycloak.yaml b/deploy/keycloak/keycloak.yaml index 5a52957..9a231ec 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: 90 + initialDelaySeconds: 60 periodSeconds: 30 readinessProbe: httpGet: path: /health/ready port: 9000 # Use management port for readiness - initialDelaySeconds: 60 + initialDelaySeconds: 30 periodSeconds: 15 affinity: # Spread pods across different nodes for higher availability diff --git a/deploy/prometheus/deploy.jsonnet b/deploy/prometheus/deploy.jsonnet index 1ede903..4ed8079 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 and persistent storage + // Prometheus customizations: external URL, persistent storage, and self-scrape enabled prometheus+:: { prometheus+: { spec+: { @@ -24,6 +24,22 @@ 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", + }, }, }, }, @@ -127,4 +143,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) } +{ [name + '-ingress']: kp.ingress[name] for name in std.objectFields(kp.ingress) } \ No newline at end of file diff --git a/deploy/prometheus/manifests/prometheus-networkPolicy.yaml b/deploy/prometheus/manifests/prometheus-networkPolicy.yaml index fa5d86c..bbe7a43 100644 --- a/deploy/prometheus/manifests/prometheus-networkPolicy.yaml +++ b/deploy/prometheus/manifests/prometheus-networkPolicy.yaml @@ -2,11 +2,7 @@ apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: labels: - 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 + k8s-app: prometheus name: prometheus-k8s namespace: monitoring spec: diff --git a/deploy/prometheus/manifests/prometheus-prometheus.yaml b/deploy/prometheus/manifests/prometheus-prometheus.yaml index e5108c1..3575f03 100644 --- a/deploy/prometheus/manifests/prometheus-prometheus.yaml +++ b/deploy/prometheus/manifests/prometheus-prometheus.yaml @@ -46,9 +46,12 @@ spec: fsGroup: 2000 runAsNonRoot: true runAsUser: 1000 + selfScrape: true serviceAccountName: prometheus-k8s serviceMonitorNamespaceSelector: {} - serviceMonitorSelector: {} + serviceMonitorSelector: + matchLabels: + k8s-app: prometheus storage: volumeClaimTemplate: spec: diff --git a/deploy/prometheus/manifests/prometheus-service.yaml b/deploy/prometheus/manifests/prometheus-service.yaml index 3efceb4..5e3005c 100644 --- a/deploy/prometheus/manifests/prometheus-service.yaml +++ b/deploy/prometheus/manifests/prometheus-service.yaml @@ -2,11 +2,7 @@ apiVersion: v1 kind: Service metadata: labels: - 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 + k8s-app: prometheus name: prometheus-k8s namespace: monitoring spec: