locust
A chart to install Locust, a scalable load testing tool written in Python. This chart will setup everything required to run a full distributed locust environment with any amount of workers. This chart will also create configmaps for storing the locust files in Kubernetes, this way there is no need to build custom docker images. By default it will install using an example locustfile and lib from [stable/locust/locustfiles/example](https://github.com/deliveryhero/helm-charts/tree/master/stable/locust/locustfiles/example). When you want to provide your own locustfile, you will need to create 2 configmaps using the structure from that example: ```console kubectl create configmap my-loadtest-locustfile --from-file path/to/your/main.py kubectl create configmap my-loadtest-lib --from-file path/to/your/lib/ ``` And then install the chart passing the names of those configmaps as values: ```console helm install locust oci://ghcr.io/deliveryhero/helm-charts/locust \ --set loadtest.name=my-loadtest \ --set loadtest.locust_locustfile_configmap=my-loadtest-locustfile \ --set loadtest.locust_lib_configmap=my-loadtest-lib ```
About this chart
locust
A chart to install Locust, a scalable load testing tool written in Python.
This chart will setup everything required to run a full distributed locust environment with any amount of workers.
This chart will also create configmaps for storing the locust files in Kubernetes, this way there is no need to build custom docker images.
By default it will install using an example locustfile and lib from stable/locust/locustfiles/example. When you want to provide your own locustfile, you will need to create 2 configmaps using the structure from that example:
kubectl create configmap my-loadtest-locustfile --from-file path/to/your/main.py
kubectl create configmap my-loadtest-lib --from-file path/to/your/lib/
And then install the chart passing the names of those configmaps as values:
helm install locust oci://ghcr.io/deliveryhero/helm-charts/locust \
--set loadtest.name=my-loadtest \
--set loadtest.locust_locustfile_configmap=my-loadtest-locustfile \
--set loadtest.locust_lib_configmap=my-loadtest-lib
Homepage: https://github.com/locustio/locust
How to install this chart
A simple install with default values, latest chart version and generated name:
helm install --generate-name oci://ghcr.io/deliveryhero/helm-charts/locust
To install a specific version of this chart:
helm install --generate-name oci://ghcr.io/deliveryhero/helm-charts/locust --version 0.35.0
To install the chart with the release name my-release:
helm install my-release oci://ghcr.io/deliveryhero/helm-charts/locust
To install with some set values:
helm install my-release oci://ghcr.io/deliveryhero/helm-charts/locust --set values_key1=value1 --set values_key2=value2
To install with custom values file:
helm install my-release oci://ghcr.io/deliveryhero/helm-charts/locust -f values.yaml
Values
| Key | Type | Default | Description |
|---|---|---|---|
| affinity | object | {} | |
| extraConfigMaps | object | {} | Any extra configmaps to mount for the master and worker. Can be used for extra python packages |
| extraLabels | object | {} | Any extra labels to apply to all resources |
| extraObjects | list | [] | Any extra manifests to deploy alongside locust. Can be used for external secret providers |
| fullnameOverride | string | "" | |
| hostAliases | list | [] | List of entries added to the /etc/hosts file on the pod to resolve custom hosts |
| image.pullPolicy | string | "IfNotPresent" | |
| image.repository | string | "locustio/locust" | |
| image.tag | string | "2.32.2" | |
| imagePullSecrets | list | [] | |
| ingress.annotations | object | {} | |
| ingress.className | string | "" | |
| ingress.enabled | bool | false | |
| ingress.hosts[0].host | string | "chart-example.local" | |
| ingress.hosts[0].path | string | "/" | |
| ingress.hosts[0].pathType | string | "ImplementationSpecific" | |
| ingress.tls | list | [] | |
| loadtest.environment | object | {} | environment variables used in the load test for both master and workers |
| loadtest.environment_external_secret | object | {} | environment variables used in the load test for both master and workers, stored in secrets created outside this chart. Each secret contains a list of values in it. Usage: secret_name: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY] |
| loadtest.environment_load_from_secrets | list | [] | environment variables used in the load test for both master and workers, stored in secrets created outside this chart. All variables from each secret are loaded. Usage: [secret_name1, secret_name2] |
| loadtest.environment_secret | object | {} | environment variables used in the load test for both master and workers, stored as secrets |
| loadtest.excludeTags | string | "" | whether to run locust with --exclude-tags [TAG [TAG ...]] options, so only tasks with no matching tags will be executed |
| loadtest.headless | bool | false | whether to run locust with headless settings |
| loadtest.locustCmd | string | "/opt/venv/bin/locust" | The command to run Locust |
| loadtest.locust_host | string | "https://www.google.com" | the host you will load test |
| loadtest.locust_lib_configmap | string | "example-lib" | name of a configmap containing your lib (default uses the example lib) |
| loadtest.locust_locustfile | string | "main.py" | the name of the locustfile |
| loadtest.locust_locustfile_configmap | string | "example-locustfile" | name of a configmap containing your locustfile (default uses the example locustfile) |
| loadtest.locust_locustfile_path | string | "/mnt/locust" | the path of the locustfile (without trailing backslash) |
| loadtest.locust_requirementsfile_path | string | "/packages" | the path of the requirements file (without trailing backslash) |
| loadtest.mount_external_secret | object | {} | additional mount used in the load test for both master and workers, stored in secrets created outside this chart. Each secret contains a list of values in it. Usage: mountPath: yourMountLocation, files: { secret_name: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY] } |
| loadtest.name | string | "example" | a name used for resources and settings in this load test |
| loadtest.pip_packages | list | [] | a list of extra python pip packages to install |
| loadtest.pip_requirementsfile | string | "requirements.txt" | |
| loadtest.pip_requirementsfile_configmap | string | "" | name of a configmap containing your extra python pip packages |
| loadtest.tags | string | "" | whether to run locust with --tags [TAG [TAG ...]] options, so only tasks with any matching tags will be executed |
| master.affinity | object | {} | Overwrites affinity from global |
| master.args | list | [] | Any extra command args for the master |
| master.auth.enabled | bool | false | When enabled using image tag 2.21.0 or later you do not need username or pass word. Older image tags you are required to |
| master.auth.password | string | "" | |
| master.auth.username | string | "" | |
| master.command[0] | string | "sh" | |
| master.command[1] | string | "/config/docker-entrypoint.sh" | |
| master.deploymentAnnotations | object | {} | Annotations on the deployment for master |
| master.environment | object | {} | environment variables for the master |
| master.envs_include_default | bool | true | Whether to include default environment variables |
| master.extraPorts | string | nil | |
| master.extraVolumeMounts | list | [] | |
| master.extraVolumes | list | [] | |
| master.image | string | "" | A custom docker image including tag |
| master.initContainers | list | [] | Init containers to run before the master container starts Useful for cloning repos, preparing data, or setting up dependencies |
| master.lifecycle | object | {} | Automated to execute a command before the main container process receives the SIGTERM |
| master.livenessProbe | object | {} | |
| master.logLevel | string | "INFO" | Log level. Can be INFO or DEBUG |
| master.nodeSelector | object | {} | Overwrites nodeSelector from global |
| master.pdb.enabled | bool | false | Whether to create a PodDisruptionBudget for the master pod |
| master.readinessProbe.failureThreshold | int | 2 | |
| master.readinessProbe.httpGet.path | string | "/" | |
| master.readinessProbe.httpGet.port | int | 8089 | |
| master.readinessProbe.httpGet.scheme | string | "HTTP" | |
| master.readinessProbe.initialDelaySeconds | int | 5 | |
| master.readinessProbe.periodSeconds | int | 30 | |
| master.readinessProbe.successThreshold | int | 1 | |
| master.readinessProbe.timeoutSeconds | int | 30 | |
| master.replicas | int | 1 | Should be set to either 0 or 1. |
| master.resources | object | {} | resources for the locust master |
| master.restartPolicy | string | "Always" | master pod's restartPolicy. Can be Always, OnFailure, or Never. |
| master.revisionHistoryLimit | int | 10 | Number of old ReplicaSets to retain to allow rollback |
| master.serviceAccountAnnotations | object | {} | |
| master.startupProbe | object | {} | |
| master.strategy.type | string | "RollingUpdate" | |
| master.terminationGracePeriodSeconds | int | 30 | Give your pod more time to shut down by increasing its terminationGracePeriodSeconds |
| master.tolerations | list | [] | Overwrites tolerations from global |
| nameOverride | string | "" | |
| nodeSelector | object | {} | |
| podSecurityContext | object | {} | |
| securityContext | object | {} | |
| service.annotations | object | {} | |
| service.extraLabels | object | {} | |
| service.loadBalancerIP | string | "" | |
| service.port | int | 8089 | |
| service.targetPort | int | 8089 | |
| service.type | string | "ClusterIP" | |
| tolerations | list | [] | |
| worker.affinity | object | {} | Overwrites affinity from global |
| worker.args | list | [] | Any extra command args for the workers |
| worker.command[0] | string | "sh" | |
| worker.command[1] | string | "/config/docker-entrypoint.sh" | |
| worker.deploymentAnnotations | object | {} | Annotations on the deployment for workers |
| worker.environment | object | {} | environment variables for the workers |
| worker.envs_include_default | bool | true | Whether to include default environment variables |
| worker.extraVolumeMounts | list | [] | |
| worker.extraVolumes | list | [] | |
| worker.hpa.enabled | bool | false | |
| worker.hpa.maxReplicas | int | 100 | |
| worker.hpa.minReplicas | int | 1 | |
| worker.hpa.targetCPUUtilizationPercentage | int | 40 | |
| worker.image | string | "" | A custom docker image including tag |
| worker.initContainers | list | [] | Init containers to run before the worker container starts Useful for cloning repos, preparing data, or setting up dependencies |
| worker.keda.cooldownPeriod | int | 30 | |
| worker.keda.enabled | bool | false | |
| worker.keda.pollingInterval | int | 15 | |
| worker.keda.triggers | string | "# https://keda.sh/docs/latest/scalers/metrics-api/\n- type: metrics-api\n metadata:\n activationTargetValue: \"0\"\n targetValue: \"50\" # Scale pods based on target users\n url: \"http://{{ template \"locust.fullname\" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ $.Values.service.port }}/stats/requests\"\n format: json\n valueLocation: 'user_count'\n" | |
| worker.logLevel | string | "INFO" | Log level. Can be INFO or DEBUG |
| worker.nodeSelector | object | {} | Overwrites nodeSelector from global |
| worker.pdb.enabled | bool | false | Whether to create a PodDisruptionBudget for the worker pods |
| worker.ports | object | {} | ports for the locust worker |
| worker.replicas | int | 1 | |
| worker.resources | object | {} | resources for the locust worker |
| worker.restartPolicy | string | "Always" | worker pod's restartPolicy. Can be Always, OnFailure, or Never. |
| worker.revisionHistoryLimit | int | 10 | Number of old ReplicaSets to retain to allow rollback |
| worker.serviceAccountAnnotations | object | {} | |
| worker.strategy.type | string | "RollingUpdate" | |
| worker.tolerations | list | [] | Overwrites tolerations from global |
Maintainers
| Name | Url | |
|---|---|---|
| max-rocket-internet | https://github.com/max-rocket-internet |
Chart source and versions
Chart source: github.com/deliveryhero/helm-charts/locust
Older chart versions: github.com/deliveryhero/helm-charts/pkgs/container/helm-charts/locust
Deploy locust with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has locust on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartlocust is pinned at v0.35.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply