- Dockerfile - builds a locust master/worker image
- kubernetes - configuration of masters/workers
- licenses - license files from various dependencies
- locust-tasks - locust scripts
- test-endpoints - contains test endpoints (echo servers) to respond to worker requests
We'll be generating load in a BACKEND cluster using http://locust.io. We will create load using 3 load balancer configurations.
- Kubernetes Service Type of LoadBalancer
- Kubernetes Service Type of LoadBalancer with an NGINX side car for TLS termination
- Kubernetes Ingress with a GCP HTTPS loadbalancer.
- cd lb-test/test-endpoints
- Connect to and authenticate with the FRONTEND GKE cluster. We'll set up our nodes and "echo" endpoints here.
- ./makesecret.sh
- kubectl apply -f loadbalancertest.yaml
- kubectl get svc
Make note of the external IP addresses assigned to echoserver-https-httpsloadbalancer and echoserver-https-httpsloadbalancer - kubectl get ingress
Make note of the ingress IP used in the HTTP load balancer. - kubectl get pods
Ensure that the pods come up without error.
-
Return to the root of where you cloned lb-test. (i.e. "cd ..")
-
cd lb-test/kubernetes
-
Connect to and authenticate with the BACKEND GKE cluster. We'll set up our locust load generators here.
-
Modify locust-master-deployment.yaml and locust-worker-deployment.yaml. Change these environment variables according to the IPs you noted when you set up the FRONTEND cluster:
- name: NOSSLURL value: http://<IP OF NLB WITHOUT SSL ENDPOINT>/ssl/nosslno - name: SIDECARURL value: https://<IP OF NLB WITH SSL SIDECAR>/ssl/sidecar - name: HTTPSLBURL value: https://<IP OF HTTPSLB ENDPOINT (FROM INGRESS)>/ssl/httpslb
Note that 2 of the URLs use HTTPS, and one uses HTTP.
-
Create the load generator endpoints.
- kubectl apply -f locust-master-deployment.yaml
- kubectl apply -f locust-worker-deployment.yaml
- kubectl apply -f locust-master-service.yaml
-
kubectl get svc
Make note of the ip for the service locust-master-lbtest -
kubectl get pods
Make sure that the pods come up without error.
- Connect to the master endpoint at http://
<
IP from backend locust-master-lbtest service>
:8089 - Generate load using 50 slaves with a hatch rate of 5 per second.
- Let it run and observe the statistics. If you wait long enough, you'll see spikes with the load balancer style endpoints.
If you have trouble getting the locust slaves and master working together, try:
- Scale down the slaves to 0
- Scale down the master to 0
- Wait for all pods to terminate
- Scale the master up to 1
- Wait for it to come up and for its web UI to be available
- Scale the slaves up to 3
- The master's WEB UI should report 3 workers (slaves) before you start a test.