From 454ebd69e753f63299a79f89e4140c41390f2d9f Mon Sep 17 00:00:00 2001 From: "Kwiatosz, Krzysztof" Date: Tue, 31 Oct 2023 14:08:07 +0100 Subject: [PATCH 1/2] Configure connectivity between keda & custom prometheus stack --- scale-to-zero-with-keda/README.md | 2 ++ .../k8s-resources/peer-authentication.yaml | 8 ++++++++ .../k8s-resources/scalable-worker-fn.yml | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 scale-to-zero-with-keda/k8s-resources/peer-authentication.yaml diff --git a/scale-to-zero-with-keda/README.md b/scale-to-zero-with-keda/README.md index f770eca8..813437bb 100644 --- a/scale-to-zero-with-keda/README.md +++ b/scale-to-zero-with-keda/README.md @@ -34,6 +34,8 @@ Make sure Istio sidecar injection is enabled in the target Namespace: kubectl label namespace default istio-injection=enabled ``` +Edit `k8s-resources/scalable-worker-fn.yml` and `k8s-resources/peer-authentication.yaml` files to fill in the namespace value (namespace where prometheus was deployed). + Apply the example resources from `./k8s-resources` directory: ```bash kubectl apply -f ./k8s-resources diff --git a/scale-to-zero-with-keda/k8s-resources/peer-authentication.yaml b/scale-to-zero-with-keda/k8s-resources/peer-authentication.yaml new file mode 100644 index 00000000..dbf0ac89 --- /dev/null +++ b/scale-to-zero-with-keda/k8s-resources/peer-authentication.yaml @@ -0,0 +1,8 @@ +apiVersion: security.istio.io/v1beta1 +kind: PeerAuthentication +metadata: + name: default + namespace: {prometheus-namespace} +spec: + mtls: + mode: PERMISSIVE \ No newline at end of file diff --git a/scale-to-zero-with-keda/k8s-resources/scalable-worker-fn.yml b/scale-to-zero-with-keda/k8s-resources/scalable-worker-fn.yml index 85911ccc..3c26f981 100644 --- a/scale-to-zero-with-keda/k8s-resources/scalable-worker-fn.yml +++ b/scale-to-zero-with-keda/k8s-resources/scalable-worker-fn.yml @@ -37,7 +37,7 @@ spec: triggers: - type: prometheus metadata: - serverAddress: http://prometheus-operated.kyma-system.svc.cluster.local:9090 + serverAddress: http://prometheus-operated.{prometheus-namespace}.svc.cluster.local:9090 query: sum(rate(istio_requests_total{destination_service="scalable-worker-fn.default.svc.cluster.local",reporter="source"}[1m])) threshold: '2' From c0e817bbd89ee2ce30057b3919928ab2e754649b Mon Sep 17 00:00:00 2001 From: Krzysztof Kwiatosz Date: Tue, 31 Oct 2023 14:43:53 +0100 Subject: [PATCH 2/2] Update scale-to-zero-with-keda/README.md Co-authored-by: Grzegorz Karaluch --- scale-to-zero-with-keda/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scale-to-zero-with-keda/README.md b/scale-to-zero-with-keda/README.md index 813437bb..0a08cd77 100644 --- a/scale-to-zero-with-keda/README.md +++ b/scale-to-zero-with-keda/README.md @@ -34,7 +34,7 @@ Make sure Istio sidecar injection is enabled in the target Namespace: kubectl label namespace default istio-injection=enabled ``` -Edit `k8s-resources/scalable-worker-fn.yml` and `k8s-resources/peer-authentication.yaml` files to fill in the namespace value (namespace where prometheus was deployed). +Edit the `k8s-resources/scalable-worker-fn.yml` and `k8s-resources/peer-authentication.yaml` files to fill in the Namespace value (Namespace where Prometheus was deployed). Apply the example resources from `./k8s-resources` directory: ```bash