Built to run on Kubernetes, this service is designed to test the performance of given applications using locust
-
Use the project's root directory as your working directory
-
Enable the necessary MicroK8s oddons
microk8s enable dns registry ingress metallb-
MicroK8s' default local registry's port is,
32000 -
Build the helper images
docker build -t builder:latest -f Dockerfiles/Dockerfile.builder .
docker build -t runner:latest -f Dockerfiles/Dockerfile.runner .- Build the images and push them to the local registry
docker build -t localhost:32000/master-release:latest -f Dockerfiles/Dockerfile.master-release .
docker push localhost:32000/master-release:latestdocker build -t localhost:32000/worker-release:latest -f Dockerfiles/Dockerfile.worker-release .
docker push localhost:32000/worker-release:latestdocker build -t localhost:32000/frontend:latest -f Dockerfiles/Dockerfile.frontend .
docker push localhost:32000/frontend:latest- Create the namespace
kubectl create namespace performance-testing- Make things easier by setting kubectl's default namespace
kubectl config set-context --current --namespace=performance-testing- Apply kubernetes yaml files
kubectl apply -f Kubernetes/pv-volume.yaml
kubectl apply -f Kubernetes/pv-claim.yaml
kubectl apply -f Kubernetes/configmap.yaml
kubectl apply -f Kubernetes/redis.yaml
kubectl apply -f Kubernetes/frontend.yaml
kubectl apply -f Kubernetes/master.yaml
kubectl apply -f Kubernetes/worker-1.yaml
kubectl apply -f Kubernetes/worker-2.yaml
kubectl apply -f Kubernetes/worker-loadbalancer.yaml
kubectl apply -f Kubernetes/ingress.yaml- Add more workers by using the WorkerCreator
python3 Kubernetes/WorkerCreator/app.py 3
kubectl apply -f Kubernetes/worker-3.yaml-
Depending on your use case and kubernetes distribution, you may edit
Kubernetes/pv-volume.yamlandKubernetes/ingress.yaml -
MicroK8s's default ingress' port is,
80 -
After building new images, reapply the deployments
# kubectl rollout restart -n <namespace> deployment <deployment>
kubectl rollout restart deployment -n performance-testing frontend-deployment
kubectl rollout restart deployment -n performance-testing master-deployment
kubectl rollout restart deployment -n performance-testing worker-1-deployment
kubectl rollout restart deployment -n performance-testing worker-2-deployment
...MasterandWorkerimages are built to run as non root users- Local persistant volumes do not support mounting a directory with non root permissions
- If you wish to use another persistant volume type, please make sure to edit the
securityContextconfigurations inKubernetes/master.yaml,Kubernetes/worker-<worerk_num>.yamlandKubernetes/WorkerCreator/template.yaml
...
spec:
...
template:
...
spec:
securityContext:
runAsUser: 101
runAsGroup: 101
fsGroup: 101
...
...- Jad K. Haddad jadkhaddad@gmail.com
© 2022 Jad K. Haddad Licensed under the MIT License
- Locust does not stop if host is not valid
- Stop test before download, or create new zip on every request
- Other features.
