From 8bdd526039c9896d7df7ac387dad74379c59c553 Mon Sep 17 00:00:00 2001 From: ArthurSens <arthursens2005@gmail.com> Date: Mon, 11 Apr 2022 07:23:09 +0000 Subject: [PATCH] jsonnet/components/prometheus: Fix grafana network access Signed-off-by: ArthurSens <arthursens2005@gmail.com> --- .../kube-prometheus/components/prometheus.libsonnet | 12 ++++++++++++ manifests/prometheus-networkPolicy.yaml | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/jsonnet/kube-prometheus/components/prometheus.libsonnet b/jsonnet/kube-prometheus/components/prometheus.libsonnet index 461a4253..7306849f 100644 --- a/jsonnet/kube-prometheus/components/prometheus.libsonnet +++ b/jsonnet/kube-prometheus/components/prometheus.libsonnet @@ -116,6 +116,18 @@ function(params) { port: o.port, protocol: 'TCP', }, p.service.spec.ports), + }, { + from: [{ + podSelector: { + matchLabels: { + 'app.kubernetes.io/name': 'grafana', + }, + }, + }], + ports: [{ + port: 9090, + protocol: 'TCP', + }], }], }, }, diff --git a/manifests/prometheus-networkPolicy.yaml b/manifests/prometheus-networkPolicy.yaml index f7a9010d..c2eec26e 100644 --- a/manifests/prometheus-networkPolicy.yaml +++ b/manifests/prometheus-networkPolicy.yaml @@ -22,6 +22,13 @@ spec: protocol: TCP - port: 8080 protocol: TCP + - from: + - podSelector: + matchLabels: + app.kubernetes.io/name: grafana + ports: + - port: 9090 + protocol: TCP podSelector: matchLabels: app.kubernetes.io/component: prometheus -- GitLab