Add example for OTel scaler + metrics from nginx ingress controller#116
Merged
Conversation
Signed-off-by: Jirka Kremser <jiri.kremser@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new PoC sample (samples/otel-ingress-nginx-poc) demonstrating KEDA OTel Scaler usage with metrics scraped from the nginx ingress controller.
Changes:
- Adds a setup script and README for deploying ingress-nginx metrics + OTel scaler.
- Adds OTel Collector/scaler Helm values to scrape ingress metrics and forward them to the scaler.
- Adds Kubernetes manifests for a simple frontend app plus KEDA ScaledObjects and Apollo Router chart values.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
samples/otel-ingress-nginx-poc/setup.sh |
Automates installing CRDs/router/ingress-nginx/OTel scaler and applying demo manifests. |
samples/otel-ingress-nginx-poc/README.md |
Documents setup steps and links to the architecture diagram. |
samples/otel-ingress-nginx-poc/otel-scaler-values.yaml |
Configures OTel Collector Prometheus scrape + filtering + export to the scaler. |
samples/otel-ingress-nginx-poc/fe.yaml |
Defines a small Node-based frontend service and ingress to generate/receive traffic. |
samples/otel-ingress-nginx-poc/fe-so.yaml |
ScaledObject intended to scale FE from ingress-nginx metrics via OTel scaler. |
samples/otel-ingress-nginx-poc/be-so.yaml |
ScaledObject intended to scale the backend/router based on Kubernetes workload presence. |
samples/otel-ingress-nginx-poc/apollo-values.yaml |
Apollo Router Helm values (supergraph init container + dev flags). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,31 @@ | |||
| #!/bin/bash | |||
|
|
|||
| k apply -f https://raw.githubusercontent.com/prometheus-community/helm-charts/refs/heads/main/charts/kube-prometheus-stack/charts/crds/crds/crd-servicemonitors.yaml | |||
Comment on lines
+4
to
+8
| helm upgrade -i msol-app-bff-main \ | ||
| --namespace other-app \ | ||
| --create-namespace \ | ||
| oci://ghcr.io/apollographql/helm-charts/router \ | ||
| -f apollo-values.yaml |
Comment on lines
+10
to
+13
| helm upgrade -i ingress-nginx ingress-nginx --reuse-values \ | ||
| https://kubernetes.github.io/ingress-nginx \ | ||
| --namespace ingress-nginx \ | ||
| --set controller.metrics.enabled=true |
Comment on lines
+5
to
+8
| helm upgrade -i nginx-ingress nginx-ingress --reuse-values \ | ||
| https://kubernetes.github.io/ingress-nginx \ | ||
| --namespace ingress-nginx \ | ||
| --set controller.metrics.enabled=true |
|
|
||
| initContainers: | ||
| - name: init-graph | ||
| image: busybox:latest |
Comment on lines
+25
to
+29
| # to test: | ||
| # kubectl -n apollo-router port-forward svc/apollo-be-router 4000:80 | ||
| # curl -s http://localhost:4000/ \ | ||
| # -H 'content-type: application/json' \ | ||
| # --data-binary '{"query":"query { __schema { queryType { fields { name } } } }"}' | jq |
Comment on lines
+19
to
+21
| 3. create scaled objects | ||
|
|
||
|
|
| @@ -0,0 +1,31 @@ | |||
| #!/bin/bash | |||
| set -e | |||
| @@ -0,0 +1,31 @@ | |||
| #!/bin/bash | |||
| set -e | |||
| k apply -f https://raw.githubusercontent.com/prometheus-community/helm-charts/refs/heads/main/charts/kube-prometheus-stack/charts/crds/crds/crd-servicemonitors.yaml | |||
Comment on lines
+4
to
+8
| helm upgrade -i msol-app-bff-main \ | ||
| --namespace other-app \ | ||
| --create-namespace \ | ||
| oci://ghcr.io/apollographql/helm-charts/router \ | ||
| -f apollo-values.yaml |
Comment on lines
+10
to
+13
| helm upgrade -i ingress-nginx ingress-nginx --reuse-values \ | ||
| https://kubernetes.github.io/ingress-nginx \ | ||
| --namespace ingress-nginx \ | ||
| --set controller.metrics.enabled=true |
Comment on lines
+5
to
+8
| helm upgrade -i nginx-ingress nginx-ingress --reuse-values \ | ||
| https://kubernetes.github.io/ingress-nginx \ | ||
| --namespace ingress-nginx \ | ||
| --set controller.metrics.enabled=true |
| - type: kedify-otel | ||
| metadata: | ||
| scalerAddress: "keda-otel-scaler.keda.svc:4318" | ||
| metricQuery: "nginx_ingress_controller_connect_duration_seconds_count{service=msol-app-fe-main,namespace=app}" |
Comment on lines
+25
to
+26
| # to test: | ||
| # kubectl -n apollo-router port-forward svc/apollo-be-router 4000:80 |
Comment on lines
+19
to
+21
| 3. create scaled objects | ||
|
|
||
|
|
Comment on lines
+23
to
+26
| helm upgrade -i keda-otel-scaler -nkeda \ | ||
| oci://ghcr.io/kedify/charts/otel-add-on \ | ||
| --version=v0.1.3 \ | ||
| -f ./otel-scaler-values.yaml |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines
+10
to
+13
| helm upgrade -i ingress-nginx ingress-nginx --reuse-values \ | ||
| https://kubernetes.github.io/ingress-nginx \ | ||
| --namespace ingress-nginx \ | ||
| --set controller.metrics.enabled=true |
Comment on lines
+4
to
+8
| helm upgrade -i my-app-be \ | ||
| --namespace other-app \ | ||
| --create-namespace \ | ||
| oci://ghcr.io/apollographql/helm-charts/router \ | ||
| -f apollo-values.yaml |
| @@ -0,0 +1,31 @@ | |||
| #!/bin/bash | |||
| set -e | |||
| k apply -f https://raw.githubusercontent.com/prometheus-community/helm-charts/refs/heads/main/charts/kube-prometheus-stack/charts/crds/crds/crd-servicemonitors.yaml | |||
| --version=v0.1.3 \ | ||
| -f ./otel-scaler-values.yaml | ||
|
|
||
| k apply -f fe.yaml -f be-so.yaml -f fe-so.yaml |
| - type: kedify-otel | ||
| metadata: | ||
| scalerAddress: "keda-otel-scaler.keda.svc:4318" | ||
| metricQuery: "nginx_ingress_controller_connect_duration_seconds_count{service=my-app-fe,namespace=app}" |
Member
Author
There was a problem hiding this comment.
no need, it accept both forms.. w/ quotes or w/o
Comment on lines
+5
to
+8
| helm upgrade -i nginx-ingress nginx-ingress --reuse-values \ | ||
| https://kubernetes.github.io/ingress-nginx \ | ||
| --namespace ingress-nginx \ | ||
| --set controller.metrics.enabled=true |
| # Architecture | ||
|  | ||
|
|
||
| [## https://excalidraw.com/#json=bMb11limAWMauy_ChBZFb,D-XdxbUT9BR6ZPcLszl5Fw](https://excalidraw.com/#json=VzaunOMs2NXOd_rTVy2yl,RU1vtVumsMIw-PxaUETKKw) No newline at end of file |
Comment on lines
+25
to
+29
| # to test: | ||
| # kubectl -n apollo-router port-forward svc/apollo-be-router 4000:80 | ||
| # curl -s http://localhost:4000/ \ | ||
| # -H 'content-type: application/json' \ | ||
| # --data-binary '{"query":"query { __schema { queryType { fields { name } } } }"}' | jq |
Comment on lines
+19
to
+21
| 3. create scaled objects | ||
|
|
||
|
|
zroubalik
approved these changes
Jun 30, 2026
Signed-off-by: Jirka Kremser <jiri.kremser@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.