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
docker build -t localhost:32000/master-release:latest -f Dockerfiles/Dockerfile.master-release .
docker build -t localhost:32000/worker-release:latest -f Dockerfiles/Dockerfile.worker-release .
docker build -t localhost:32000/frontend:latest -f Dockerfiles/Dockerfile.frontend .
- Or use docker compose to build the images
docker-compose -f Dockerfiles/Docker-compose.yaml build
- Push the images to the local registry
docker push localhost:32000/master-release:latest
docker push localhost:32000/worker-release:latest
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.yaml
andKubernetes/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
...
Master
andWorker
images 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
securityContext
configurations inKubernetes/master.yaml
,Kubernetes/worker-<worerk_num>.yaml
andKubernetes/WorkerCreator/template.yaml
...
spec:
...
template:
...
spec:
securityContext:
runAsUser: 101
runAsGroup: 101
fsGroup: 101
...
...
docker-compose -f Dockerfiles/Docker-compose-helpers.yaml build
docker-compose -f Dockerfiles/Docker-compose.yaml up
- Entrypoint is
host:8000
- Todo
- Jad K. Haddad [email protected]
© 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..