Skip to content

How to conduct performance testing with Clusterloader2

Article Number: 000020179

Situation

How to conduct performance testing with Clusterloader2

Clusterloader is an opensource performance testing tool to measure the performance metrics of your Kubernetes cluster.

Pre-requisites

  • Linux or Mac machine that has Golang and kubectl installed
  • SSH key of the Kubernetes master node
  • Kubeconfig file of the target cluster

Steps

  1. Create a folder named k8s.io under ~/go/src/:

mkdir ~/go/src/k8s.io
2. Clone the perf-test under k8s.io folder:

cd ~/go/src/k8s.io && git clone https://github.com/galal-hussein/perf-tests.git
3. Navigate to the clusterloader2 directory:

cd ~/go/src/k8s.io/perf-tests/clusterloader2
4. Edit the testconfig according to the environment:

vim testing/load/config.yaml
5. Execute the clusterloader2 with appropriate options:

KUBE_SSH_USER=<SSH USERNAME> LOCAL_SSH_KEY=<SSH KEY PATH> go run cmd/clusterloader.go --nodes 3 --mastername=<MASTER NODE NAME> --kubeconfig=<KUBECONFIG FILE PATH> --provider=local --masterip=<MASTER NODE IP ADDRESS> --testconfig=testing/<TESTING SUBJECT>/config.yaml --report-dir=/tmp/reports 2>&1 | tee /tmp/tmp.log
6. The results of the testing will be stored in the /tmp/reports directory.

FAQ

Errors: [config reading error: decoding failed: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal number -4611686018427388 into Go struct field Phase.Steps.Phases.ReplicasPerNamespace of type int32]"
  • Change the value of {{$NODES_PER_NAMESPACE := DefaultParam .NODES_PER_NAMESPACE 1}} to match the number of the nodes in the config.yaml file
level=warning msg="Got errors during step execution: [measurement call APIResponsiveness - APIResponsiveness error: unexpected response: \"# HELP aggregator_openapi_v2_regeneration_count [ALPHA] Counter of OpenAPI v2 spec regeneration count broken down by causing APIService name and reason.
  • Comment out the APIResponsiveness section in config.yaml:
measurements:
- Identifier: APIResponsiveness
  Method: APIResponsiveness
  Params:
    action: reset

Further reading

https://github.com/kubernetes/perf-tests