Skip to content

Commit e8024c1

Browse files
authored
Update http-scaling.md
1 parent 3c9336e commit e8024c1

File tree

1 file changed

+48
-46
lines changed
  • content/learning-paths/servers-and-cloud-computing/kedify-http-autoscaling

1 file changed

+48
-46
lines changed

content/learning-paths/servers-and-cloud-computing/kedify-http-autoscaling/http-scaling.md

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,48 @@ weight: 4
44
layout: "learningpathall"
55
---
66

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.
88

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).
1010

1111
## How it works
1212

1313
With ingress autowiring enabled, Kedify automatically routes traffic through its proxy before it reaches your Service/Deployment:
1414

15-
```
15+
```output
1616
Ingress → kedify-proxy → Service → Deployment
1717
```
1818

1919
The [Kedify Proxy](https://docs.kedify.io/scalers/http-scaler/#kedify-proxy) gathers request metrics used by the scaler to make decisions.
2020

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`
2625

27-
## Step 0Set up Ingress IP environment variable
26+
## Step 1Configure the Ingress IP environment variable
2827

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 controllers external IP address or hostname.
3029

3130
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:
3231

3332
```bash
3433
export INGRESS_IP=$(kubectl get service ingress-nginx-controller --namespace=ingress-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}{.status.loadBalancer.ingress[0].hostname}')
3534
echo "Ingress IP/Hostname: $INGRESS_IP"
3635
```
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.
3837

3938
{{% 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.
4140
{{% /notice %}}
4241

43-
## Step 1Create the application and Ingress
42+
## Step 2Deploy the application and configure Ingress
4443

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).
4645

4746
#### Deploy the application
4847

49-
Run the following command to deploy our application:
48+
Run the following command to deploy your application:
5049

5150
```bash
5251
cat <<'EOF' | kubectl apply -f -
@@ -123,37 +122,37 @@ Notes:
123122

124123
#### Verify the application is running correctly
125124

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:
127126

128127
```bash
129128
kubectl get deployment application
130129
```
131130

132-
In the output we should see 1 replica ready:
133-
```
131+
In the output you should see 1 replica ready:
132+
```output
134133
NAME READY UP-TO-DATE AVAILABLE AGE
135134
application 1/1 1 1 3m44s
136135
```
137136

138137
#### 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:
140139

141140
```bash
142141
curl -I -H "Host: application.keda" http://$INGRESS_IP
143142
```
144143

145-
You should see similar output:
146-
```
144+
If the routing is set up properly, you should see a response similar to:
145+
```output
147146
HTTP/1.1 200 OK
148147
Date: Thu, 11 Sep 2025 14:11:24 GMT
149148
Content-Type: text/html
150149
Content-Length: 301
151150
Connection: keep-alive
152151
```
153152

154-
## Step 2 — Enable autoscaling with Kedify
153+
## Step 3 — Enable autoscaling with Kedify
155154

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:
157156

158157
```bash
159158
cat <<'EOF' | kubectl apply -f -
@@ -193,25 +192,25 @@ spec:
193192
EOF
194193
```
195194

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.
203202

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/).
205204

206205
![Kedify Dashboard With ScaledObject](images/scaledobject.png)
207206

208-
## Step 3 — Send traffic and observe scaling
207+
## Step 4 — Send traffic and observe scaling
209208

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.
211210

212211
#### Verify scale to zero
213212

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:
215214

216215
```bash
217216
watch kubectl get deployment application -n default
@@ -224,31 +223,35 @@ Every 2,0s: kubectl get deployment application -n default
224223
NAME READY UP-TO-DATE AVAILABLE AGE
225224
application 0/0 0 0 110s
226225
```
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.
227227

228228
#### Verify the app can scale from zero
229229

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:
231+
231232
```bash
232233
curl -I -H "Host: application.keda" http://$INGRESS_IP
233234
```
234-
235-
You should see a 200 OK response. Next, generate sustained load. You can use `hey` (or a similar tool):
235+
The application should scale from 0 → 1 replica automatically.
236+
You should receive an HTTP 200 OK response, confirming that the service is reachable again.
236237

237238
#### Test higher load
238239

240+
Now, generate a heavier, sustained load against the application. You can use `hey` (or a similar benchmarking tool):
241+
239242
```bash
240243
hey -n 40000 -c 200 -host "application.keda" http://$INGRESS_IP
241244
```
242245

243-
While the load runs, watch replicas change:
246+
While the load test is running, open another terminal and monitor the deployment replicas in real time:
244247

245248
```bash
246249
watch kubectl get deployment application -n default
247250
```
248251

249-
For example something like this:
252+
You will see the number of replicas change dynamically. For example:
250253

251-
```
254+
```output
252255
Every 2,0s: kubectl get deployment application -n default
253256
254257
NAME READY UP-TO-DATE AVAILABLE AGE
@@ -259,23 +262,22 @@ Expected behavior:
259262
- On bursty load, Kedify scales the Deployment up toward `maxReplicaCount`.
260263
- When traffic subsides, replicas scale down. After the cooldown, they can return to zero.
261264

262-
You can also observe traffic and scaling in the Kedify dashboard:
265+
You can also monitor traffic and scaling in the Kedify dashboard:
263266

264267
![Kedify Dashboard ScaledObject Detail](images/load.png)
265268

266269
## Clean up
267270

271+
When you have finished testing, remove the resources created in this Learning Path to free up your cluster:
272+
268273
```bash
269274
kubectl delete scaledobject application
270275
kubectl delete ingress application-ingress
271276
kubectl delete service application-service
272277
kubectl delete deployment application
273278
```
279+
This will delete the `ScaledObject`, Ingress, Service, and Deployment associated with the demo application.
274280

275281
## Next steps
276282

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

Comments
 (0)