From b8f0bf6b9a4a13bb0defcad29b553ab88cd810ec Mon Sep 17 00:00:00 2001 From: Rachel Lawton Date: Wed, 9 Oct 2024 10:51:32 +0100 Subject: [PATCH] Changing the namespace for the pod monitors as gateway-namesapce is no longer created with istio being installed by sail (#917) Signed-off-by: R-Lawton --- config/observability/README.md | 1 + config/observability/kustomization.yaml | 7 ------- config/observability/openshift/telemetry.yaml | 2 +- .../prometheus/monitors/envoy/kustomization.yaml | 4 ++++ .../monitors/{ => envoy}/pod-monitor-envoy.yaml | 8 +++++--- .../monitors/envoy/service-monitor.yaml | 15 +++++++++++++++ .../prometheus/monitors/istio/kustomization.yaml | 4 ++++ .../{ => istio}/service-monitor-istiod.yaml | 4 +++- .../{ => monitors/istio}/telemetry.yaml | 3 ++- hack/quickstart-setup.sh | 2 ++ 10 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 config/observability/prometheus/monitors/envoy/kustomization.yaml rename config/observability/prometheus/monitors/{ => envoy}/pod-monitor-envoy.yaml (64%) create mode 100644 config/observability/prometheus/monitors/envoy/service-monitor.yaml create mode 100644 config/observability/prometheus/monitors/istio/kustomization.yaml rename config/observability/prometheus/monitors/{ => istio}/service-monitor-istiod.yaml (82%) rename config/observability/prometheus/{ => monitors/istio}/telemetry.yaml (95%) diff --git a/config/observability/README.md b/config/observability/README.md index 654c3052e..3ea918ce7 100644 --- a/config/observability/README.md +++ b/config/observability/README.md @@ -9,6 +9,7 @@ If however you have run `make local-setup` and would like to install the observa ```bash ./bin/kustomize build ./config/observability/| docker run --rm -i docker.io/ryane/kfilt -i kind=CustomResourceDefinition | kubectl apply --server-side -f - ./bin/kustomize build ./config/observability/| docker run --rm -i docker.io/ryane/kfilt -x kind=CustomResourceDefinition | kubectl apply -f - +./bin/kustomize build ./config/observability/prometheus/monitors/envoy | kubectl apply -f - ./bin/kustomize build ./config/thanos | kubectl apply -f - ./bin/kustomize build ./examples/dashboards | kubectl apply -f - ./bin/kustomize build ./examples/alerts | kubectl apply -f - diff --git a/config/observability/kustomization.yaml b/config/observability/kustomization.yaml index daf19d080..fd21cc4be 100644 --- a/config/observability/kustomization.yaml +++ b/config/observability/kustomization.yaml @@ -4,12 +4,6 @@ kind: Kustomization resources: - github.com/prometheus-operator/kube-prometheus?ref=release-0.13 - github.com/Kuadrant/gateway-api-state-metrics/config/kuadrant?ref=0.5.0 -# To scrape istio metrics, 3 configurations are required: -# 1. Envoy metrics directly from the istio ingress gateway pod - - prometheus/monitors/pod-monitor-envoy.yaml -# 2. Istiod metrics via the istiod service - - prometheus/monitors/service-monitor-istiod.yaml -# 3. Istio metrics exposed via envoy on 15020 in each application. # We're using the additionalScrapeConfigs field of the Prometheus CR # here to read existing prometheus scrape annotations on pods. # Ideally this would be done via another PodMonitor or ServicMonitor, @@ -24,7 +18,6 @@ resources: - prometheus/monitors/service-monitor-authorino-operator.yaml - prometheus/monitors/service-monitor-dns-operator.yaml - - prometheus/telemetry.yaml patchesStrategicMerge: - rbac/cluster_role.yaml diff --git a/config/observability/openshift/telemetry.yaml b/config/observability/openshift/telemetry.yaml index 7b6c6f11f..c3a7509b2 100644 --- a/config/observability/openshift/telemetry.yaml +++ b/config/observability/openshift/telemetry.yaml @@ -2,7 +2,7 @@ apiVersion: telemetry.istio.io/v1alpha1 kind: Telemetry metadata: name: namespace-metrics - namespace: gateway-system + namespace: istio-system spec: metrics: - providers: diff --git a/config/observability/prometheus/monitors/envoy/kustomization.yaml b/config/observability/prometheus/monitors/envoy/kustomization.yaml new file mode 100644 index 000000000..1c9869913 --- /dev/null +++ b/config/observability/prometheus/monitors/envoy/kustomization.yaml @@ -0,0 +1,4 @@ +resources: +- pod-monitor-envoy.yaml +- service-monitor.yaml + diff --git a/config/observability/prometheus/monitors/pod-monitor-envoy.yaml b/config/observability/prometheus/monitors/envoy/pod-monitor-envoy.yaml similarity index 64% rename from config/observability/prometheus/monitors/pod-monitor-envoy.yaml rename to config/observability/prometheus/monitors/envoy/pod-monitor-envoy.yaml index e10c5c54d..128770980 100644 --- a/config/observability/prometheus/monitors/pod-monitor-envoy.yaml +++ b/config/observability/prometheus/monitors/envoy/pod-monitor-envoy.yaml @@ -2,13 +2,15 @@ apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: envoy-stats + namespace: envoy-gateway-system spec: namespaceSelector: matchNames: - - gateway-system + - gateway-system selector: matchLabels: app: kuadrant-ingressgateway podMetricsEndpoints: - - port: http-envoy-prom - path: /stats/prometheus + - port: http-envoy-prom + path: /stats/prometheus + diff --git a/config/observability/prometheus/monitors/envoy/service-monitor.yaml b/config/observability/prometheus/monitors/envoy/service-monitor.yaml new file mode 100644 index 000000000..b47b35c96 --- /dev/null +++ b/config/observability/prometheus/monitors/envoy/service-monitor.yaml @@ -0,0 +1,15 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: envoy-gateway + namespace: envoy-gateway-system +spec: + namespaceSelector: + matchNames: + - envoy-gateway-system + selector: + matchLabels: + control-plane: envoy-gateway + endpoints: + - port: metrics + diff --git a/config/observability/prometheus/monitors/istio/kustomization.yaml b/config/observability/prometheus/monitors/istio/kustomization.yaml new file mode 100644 index 000000000..b2f343362 --- /dev/null +++ b/config/observability/prometheus/monitors/istio/kustomization.yaml @@ -0,0 +1,4 @@ +resources: + - service-monitor-istiod.yaml + - telemetry.yaml + diff --git a/config/observability/prometheus/monitors/service-monitor-istiod.yaml b/config/observability/prometheus/monitors/istio/service-monitor-istiod.yaml similarity index 82% rename from config/observability/prometheus/monitors/service-monitor-istiod.yaml rename to config/observability/prometheus/monitors/istio/service-monitor-istiod.yaml index 54dcd4257..e2af452b7 100644 --- a/config/observability/prometheus/monitors/service-monitor-istiod.yaml +++ b/config/observability/prometheus/monitors/istio/service-monitor-istiod.yaml @@ -2,12 +2,14 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: istiod + namespace: istio-system spec: namespaceSelector: matchNames: - - gateway-system + - istio-system selector: matchLabels: app: istiod endpoints: - port: http-monitoring + diff --git a/config/observability/prometheus/telemetry.yaml b/config/observability/prometheus/monitors/istio/telemetry.yaml similarity index 95% rename from config/observability/prometheus/telemetry.yaml rename to config/observability/prometheus/monitors/istio/telemetry.yaml index df37e0aab..d39050a9a 100644 --- a/config/observability/prometheus/telemetry.yaml +++ b/config/observability/prometheus/monitors/istio/telemetry.yaml @@ -2,7 +2,7 @@ apiVersion: telemetry.istio.io/v1alpha1 kind: Telemetry metadata: name: namespace-metrics - namespace: gateway-system + namespace: istio-system spec: metrics: - providers: @@ -26,3 +26,4 @@ spec: value: "request.host" request_url_path: value: "request.url_path" + diff --git a/hack/quickstart-setup.sh b/hack/quickstart-setup.sh index 06a63cb4a..b5cb7c969 100755 --- a/hack/quickstart-setup.sh +++ b/hack/quickstart-setup.sh @@ -84,6 +84,7 @@ KUADRANT_CERT_MANAGER_KUSTOMIZATION="${KUADRANT_REPO}/config/dependencies/cert-m KUADRANT_METALLB_KUSTOMIZATION="${KUADRANT_REPO}/config/metallb?ref=${KUADRANT_REF}" KUADARNT_THANOS_KUSTOMIZATION="${KUADRANT_REPO}/config/thanos?ref=${KUADRANT_REF}" KUADARNT_OBSERVABILITY_KUSTOMIZATION="${KUADRANT_REPO}/config/observability?ref=${KUADRANT_REF}" +KUADARNT_OBSERVABILITY_ISTIO_KUSTOMIZATION="${KUADRANT_REPO}/config/observability/prometheus/monitors/istio?ref=${KUADRANT_REF}" KUADRANT_DASHBOARDS_KUSTOMIZATION="${KUADRANT_REPO}/examples/dashboards?ref=${KUADRANT_REF}" KUADRANT_ALERTS_KUSTOMIZATION="${KUADRANT_REPO}/examples/alerts?ref=${KUADRANT_REF}" MGC_REPO="github.com/${KUADRANT_ORG}/multicluster-gateway-controller.git" @@ -462,6 +463,7 @@ fi info "Installing observability stack in ${KUADRANT_CLUSTER_NAME}..." kubectl kustomize ${KUADARNT_OBSERVABILITY_KUSTOMIZATION} | $CONTAINER_RUNTIME_BIN run --rm -i docker.io/ryane/kfilt -i kind=CustomResourceDefinition | kubectl apply --server-side -f - kubectl kustomize ${KUADARNT_OBSERVABILITY_KUSTOMIZATION} | $CONTAINER_RUNTIME_BIN run --rm -i docker.io/ryane/kfilt -x kind=CustomResourceDefinition | kubectl apply -f - +kubectl kustomize ${KUADARNT_OBSERVABILITY_ISTIO_KUSTOMIZATION} | kubectl apply --server-side -f - kubectl kustomize ${KUADRANT_DASHBOARDS_KUSTOMIZATION} | kubectl apply --server-side -f - kubectl kustomize ${KUADRANT_ALERTS_KUSTOMIZATION} | kubectl apply --server-side -f - success "observability stack installed successfully."