This guide explains how to perform load testing and auto-scaling using KEDA and HTTP Add-on in a Kubernetes environment. Follow the steps below to set up your environment and conduct tests.
Create a local Kubernetes cluster using Kind (Kubernetes in Docker) by running the following command:
kind create cluster --config kind-ingress-config.yamlInstall the NGINX Ingress Controller to manage ingress traffic:
kubectl apply --filename https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yamlVerify that the ingress controller has been installed successfully:
kubectl get pods -n ingress-nginxInstall the KEDA operator using Helm:
helm repo add kedacore https://kedacore.github.io/charts
helm repo update
helm install keda kedacore/keda --namespace keda --create-namespaceInstall the KEDA HTTP Add-on by running:
helm install http-add-on kedacore/keda-add-ons-http --namespace kedaCheck that the HTTP Add-on components are running:
kubectl get pods -n kedaDeploy a test Deployment, Service, and HTTPScaledObject resources.
-
Create a namespace:
kubectl create ns test -
Apply application and service resources:
kubectl apply -f nginx-app.yaml -n test kubectl apply -f external-proxy-service.yaml -n test kubectl apply -f httpscaleobject.yaml -n test
-
Verify that the resources have been successfully created:
kubectl get all -n test
To perform a load test using K6, create and save the following script (k6-load.js):
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
vus: 50, // 50 virtual users concurrently
duration: '600s', // Test duration of 10 minutes
};
export default function () {
const url = 'http://127.0.0.1';
const params = {
headers: {
'Host': 'www.sevgin.com',
},
};
http.get(url, params);
sleep(1);
}Run the load test using:
k6 run k6-load.jsDuring the load test, KEDA HTTP Add-on will automatically scale the number of pods. To monitor the scaling activity, run:
kubectl get pods -w -n test





