loadgen.sh load generation script¶
loadgen.sh is a shell script provided within the helloworld sample directory, designed to artificially generate traffic for testing purposes^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md]. It is typically employed to validate Horizontal Pod Autoscaler (HPA) functionality by inducing stress on service resources^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md].
Usage¶
To generate significant load on the service instances, the script can be executed in the background multiple times^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md]:
./loadgen.sh &
./loadgen.sh &
Running the script multiple times simultaneously ensures that sufficient traffic is created to trigger autoscaling events within a short observation window^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md].
Verification¶
After executing the script and waiting approximately two minutes, the impact on the cluster can be verified by checking the status of the Horizontal Pod Autoscaler^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md]:
kubectl get hpa
If the load generation and autoscaler configuration are correct, the REPLICAS column should display a value greater than 1, indicating that the service has scaled out in response to the load^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md].