You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/03-tutorials/00-serverless/svls-15-use-external-scalers.md
+75-4Lines changed: 75 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -66,8 +66,8 @@ Follow these steps:
66
66
67
67
</details>
68
68
<details>
69
-
<summary label="keda">
70
-
Keda
69
+
<summary label="keda-cpu">
70
+
Keda CPU
71
71
</summary>
72
72
73
73
1. Install [Keda](https://keda.sh/docs/2.8/deploy/) if it is not present on your cluster.
@@ -118,9 +118,9 @@ Follow these steps:
118
118
EOF
119
119
```
120
120
121
-
>**NOTE:** in this tutorial we use the `cpu` trigger because of its simple configuration. If you want to use another trigger check the official [list of supported triggers](https://keda.sh/docs/2.8/scalers/).
121
+
>**NOTE:** This tutorial uses the `cpu` trigger because of its simple configuration. If you want to use another trigger check the official [list of supported triggers](https://keda.sh/docs/2.8/scalers/).
122
122
123
-
4. After a few seconds ScaledObject should be up to date and contain information about actual replicas:
123
+
4. After a few seconds ScaledObject should be up to date and contain information about the actual replicas:
124
124
125
125
```bash
126
126
kubectl get scaledobject scaled-function
@@ -133,5 +133,76 @@ Follow these steps:
133
133
scaled-function serverless.kyma-project.io/v1alpha2.Function scaled-function 5 10 cpu True True Unknown 4m15s
134
134
```
135
135
136
+
</details>
137
+
<details>
138
+
<summary label="keda-prometheus">
139
+
Keda Prometheus
140
+
</summary>
141
+
142
+
1. Install [Keda](https://keda.sh/docs/2.8/deploy/) if it is not present on your cluster.
143
+
144
+
2. Create your Function with the `replicas` value set to 1, to prevent the internal Serverless HPA creation:
145
+
146
+
```yaml
147
+
cat <<EOF | kubectl apply -f -
148
+
apiVersion: serverless.kyma-project.io/v1alpha2
149
+
kind: Function
150
+
metadata:
151
+
name: scaled-function
152
+
spec:
153
+
runtime: nodejs14
154
+
replicas: 1
155
+
source:
156
+
inline:
157
+
dependencies: ""
158
+
source: |
159
+
module.exports = {
160
+
main: function(event, context) {
161
+
return 'Hello World!'
162
+
}
163
+
}
164
+
EOF
165
+
```
166
+
167
+
3. Create the ScaledObject resource based on the `istio_requests_total` metric, exposed by the Istio:
168
+
169
+
```yaml
170
+
cat <<EOF | kubectl apply -f -
171
+
apiVersion: keda.sh/v1alpha1
172
+
kind: ScaledObject
173
+
metadata:
174
+
name: scaled-function
175
+
spec:
176
+
scaleTargetRef:
177
+
apiVersion: serverless.kyma-project.io/v1alpha2
178
+
kind: Function
179
+
name: scaled-function
180
+
minReplicaCount: 1 # You can go with 0 ( scaling to zero ) in case your function is fed from messaging queue that would buffer unhandled requests or if you are fine with function downtime at cold start periods
>**NOTE:** This tutorial uses the `prometheus` trigger because of its simple configuration. If you want to use another trigger check the official [list of supported triggers](https://keda.sh/docs/2.8/scalers/).
193
+
194
+
4. After a few seconds ScaledObject should be up to date and contain information about the actual replicas:
195
+
196
+
```bash
197
+
kubectl get scaledobject scaled-function
198
+
```
199
+
200
+
You should get a result similar to this example:
201
+
202
+
```bash
203
+
NAME SCALETARGETKIND SCALETARGETNAME MIN MAX TRIGGERS AUTHENTICATION READY ACTIVE FALLBACK AGE
0 commit comments