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: content/learning-paths/servers-and-cloud-computing/kedify-http-autoscaling/http-scaling.md
+48-46Lines changed: 48 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,49 +4,48 @@ weight: 4
4
4
layout: "learningpathall"
5
5
---
6
6
7
-
Use this section to get a quick, hands-on feel for Kedify HTTP autoscaling. We’ll deploy a small web service, expose it through a standard Kubernetes Ingress, and rely on Kedify’s autowiring to route traffic via its proxy so requests are measured and drive scaling.
7
+
In this section, you’ll gain hands-on experience with Kedify HTTP autoscaling. You will deploy a small web service, expose it through a standard Kubernetes Ingress, and rely on Kedify’s autowiring to route traffic via its proxy so requests are measured and drive scaling.
8
8
9
-
Scale a real HTTP app exposed through Kubernetes Ingress using Kedify’s [kedify-http](https://docs.kedify.io/scalers/http-scaler/) scaler. You will deploy a simple app, enable autoscaling with a [ScaledObject](https://keda.sh/docs/latest/concepts/scaling-deployments/), generate load, and observe the system scale out and back in (including scale-to-zero when idle).
9
+
You will scale a real HTTP app exposed through Kubernetes Ingress using Kedify’s [kedify-http](https://docs.kedify.io/scalers/http-scaler/) scaler. You will deploy a simple application, enable autoscaling with a [ScaledObject](https://keda.sh/docs/latest/concepts/scaling-deployments/), generate load, and observe the system scale out and back in (including scale-to-zero when idle).
10
10
11
11
## How it works
12
12
13
13
With ingress autowiring enabled, Kedify automatically routes traffic through its proxy before it reaches your Service/Deployment:
14
14
15
-
```
15
+
```output
16
16
Ingress → kedify-proxy → Service → Deployment
17
17
```
18
18
19
19
The [Kedify Proxy](https://docs.kedify.io/scalers/http-scaler/#kedify-proxy) gathers request metrics used by the scaler to make decisions.
20
20
21
-
## What you’ll deploy
22
-
23
-
- Deployment & Service: an HTTP server with a small response delay to simulate work
24
-
- Ingress: public entry using host `application.keda`
25
-
- ScaledObject: Kedify HTTP scaler with `trafficAutowire: ingress`
21
+
## Deployment Overview
22
+
* Deployment & Service: An HTTP server with a small response delay to simulate work
23
+
* Ingress: Public entry point configured using host `application.keda`
24
+
* ScaledObject: A Kedify HTTP scaler using `trafficAutowire: ingress`
26
25
27
-
## Step 0 — Set up Ingress IP environment variable
26
+
## Step 1 — Configure the Ingress IP environment variable
28
27
29
-
Before testing the application, ensure you have the `INGRESS_IP` environment variable set with your ingress controller's external IP or hostname.
28
+
Before testing the application, make sure the INGRESS_IP environment variable is set to your ingress controller’s external IP address or hostname.
30
29
31
30
If you followed the [Install Ingress Controller](../install-ingress/) guide, you should already have this set. If not, or if you're using an existing ingress controller, run this command:
32
31
33
32
```bash
34
33
export INGRESS_IP=$(kubectl get service ingress-nginx-controller --namespace=ingress-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}{.status.loadBalancer.ingress[0].hostname}')
35
34
echo"Ingress IP/Hostname: $INGRESS_IP"
36
35
```
37
-
You should now have the correct IP address or hostname stored in the `$INGRESS_IP` environment variable. If the command doesn't print any value, please repeat it after some time.
36
+
This will store the correct IP or hostname in the $INGRESS_IP environment variable. If no value is returned, wait a short while and try again.
38
37
39
38
{{% notice Note %}}
40
-
If your ingress controller service has a different name or namespace, adjust the command accordingly. For example, some installations use `nginx-ingress-controller` or place it in a different namespace.
39
+
If your ingress controller service uses a different name or namespace, update the command accordingly. For example, some installations use `nginx-ingress-controller` or place it in a different namespace.
41
40
{{% /notice %}}
42
41
43
-
## Step 1 — Create the application and Ingress
42
+
## Step 2 — Deploy the application and configure Ingress
44
43
45
-
Let's start with deploying an application that responds to an incoming HTTP server and is exposed via Ingress. You can check the source code of the application on [GitHub](https://github.com/kedify/examples/tree/main/samples/http-server).
44
+
Now you will deploy a simple HTTP server and expose it using an Ingress resource. The source code for this application is available on [GitHub](https://github.com/kedify/examples/tree/main/samples/http-server).
46
45
47
46
#### Deploy the application
48
47
49
-
Run the following command to deploy our application:
48
+
Run the following command to deploy your application:
50
49
51
50
```bash
52
51
cat <<'EOF' | kubectl apply -f -
@@ -123,37 +122,37 @@ Notes:
123
122
124
123
#### Verify the application is running correctly
125
124
126
-
Let's check that we have 1 replica of the application deployed and ready:
125
+
You will now check if you have 1 replica of the application deployed and ready:
127
126
128
127
```bash
129
128
kubectl get deployment application
130
129
```
131
130
132
-
In the output we should see 1 replica ready:
133
-
```
131
+
In the output you should see 1 replica ready:
132
+
```output
134
133
NAME READY UP-TO-DATE AVAILABLE AGE
135
134
application 1/1 1 1 3m44s
136
135
```
137
136
138
137
#### Test the application
139
-
Hit the app to confirm the app is ready and routing works:
138
+
Once the application and Ingress are deployed, verify that everything is working correctly by sending a request to the exposed endpoint. Run the following command:
If the routing is set up properly, you should see a response similar to:
145
+
```output
147
146
HTTP/1.1 200 OK
148
147
Date: Thu, 11 Sep 2025 14:11:24 GMT
149
148
Content-Type: text/html
150
149
Content-Length: 301
151
150
Connection: keep-alive
152
151
```
153
152
154
-
## Step 2 — Enable autoscaling with Kedify
153
+
## Step 3 — Enable autoscaling with Kedify
155
154
156
-
The application is currectly running, Now we will enable autoscaling on this app, we will scale from 0 to 10 replicas. No request shall be lost at any moment. To do that, please run the following command to deploy our `ScaledObject`:
155
+
The application is now running. Next, you will enable autoscaling so that it can scale dynamically between 0 and 10 replicas. Kedify ensures that no requests are dropped during scaling. Apply the `ScaledObject` by running the following command:
157
156
158
157
```bash
159
158
cat <<'EOF' | kubectl apply -f -
@@ -193,25 +192,25 @@ spec:
193
192
EOF
194
193
```
195
194
196
-
What the key fields do:
197
-
-`type: kedify-http` — Use Kedify’s HTTP scaler.
198
-
-`hosts`, `pathPrefixes` — Which requests to observe for scaling.
199
-
-`service`, `port` — The Service and port receiving traffic.
200
-
-`scalingMetric: requestRate` and `targetValue: 10` — Target 1000 req/s (per granularity/window) before scaling out.
201
-
-`minReplicaCount: 0` — Allows scale-to-zero when idle.
202
-
-`trafficAutowire: ingress` — Lets Kedify auto-wire your Ingress to the kedify-proxy.
195
+
Key Fields explained:
196
+
-`type: kedify-http` — Specifies that Kedify’s HTTP scaler should be used.
197
+
-`hosts`, `pathPrefixes` — Define which requests are monitored for scaling decisions.
198
+
-`service`, `port` — TIdentify the Kubernetes Service and port that will receive the traffic.
199
+
-`scalingMetric: requestRate` and `targetValue: 10` — Scale out when request rate exceeds the target threshold (e.g., 1000 req/s per window, depending on configuration granularity).
200
+
-`minReplicaCount: 0` — Enables scale-to-zero when there is no traffic.
201
+
-`trafficAutowire: ingress` — Automatically wires your Ingress to the Kedify proxy for seamless traffic management.
203
202
204
-
After applying, the ScaledObject will appear in the Kedify dashboard (https://dashboard.kedify.io/).
203
+
After applying, the `ScaledObject` will appear in the Kedify dashboard (https://dashboard.kedify.io/).
205
204
206
205

207
206
208
-
## Step 3 — Send traffic and observe scaling
207
+
## Step 4 — Send traffic and observe scaling
209
208
210
-
Becuase we are not sending any traffic to our application, after some time, it should be scaled to zero.
209
+
Since no traffic is currently being sent to the application, it will eventually scale down to zero replicas.
211
210
212
211
#### Verify scale to zero
213
212
214
-
Run this command and wait until there is 0 replicas:
213
+
To confirm that the application has scaled down, run the following command and watch until the number of replicas reaches 0:
215
214
216
215
```bash
217
216
watch kubectl get deployment application -n default
@@ -224,31 +223,35 @@ Every 2,0s: kubectl get deployment application -n default
224
223
NAME READY UP-TO-DATE AVAILABLE AGE
225
224
application 0/0 0 0 110s
226
225
```
226
+
This continuously monitors the deployment status in the default namespace. Once traffic stops and the idle window has passed, you should see the application deployment report 0/0 replicas, indicating that it has successfully scaled to zero.
227
227
228
228
#### Verify the app can scale from zero
229
229
230
-
Now, hit the app again, it should be scaled to 1 replica and return back correct response:
230
+
Next, test that the application can scale back up from zero when traffic arrives. Send a request to the app:
When you have finished testing, remove the resources created in this Learning Path to free up your cluster:
272
+
268
273
```bash
269
274
kubectl delete scaledobject application
270
275
kubectl delete ingress application-ingress
271
276
kubectl delete service application-service
272
277
kubectl delete deployment application
273
278
```
279
+
This will delete the `ScaledObject`, Ingress, Service, and Deployment associated with the demo application.
274
280
275
281
## Next steps
276
282
277
-
Explore the official Kedify [How-to guides](https://docs.kedify.io/how-to/) for more configurations such as Gateway API, Istio VirtualService, or OpenShift Routes.
278
-
279
-
### See also
280
-
281
-
- Kedify documentation: https://docs.kedify.io
283
+
To go futher, you can explore the Kedify [How-to guides](https://docs.kedify.io/how-to/) for more configurations such as Gateway API, Istio VirtualService, or OpenShift Routes.
0 commit comments