github.com/kubeshop/testkube@v1.17.23/contrib/executor/k6/README.md (about) 1  2 3 # Welcome to TestKube k6 Executor 4 5 TestKube k6 Executor is a test executor to run k6 load tests with [TestKube](https://testkube.io). 6 7 ## Usage 8 9 You need to register and deploy the executor in your cluster. Additionally, you may deploy InfluxDB as well as Grafana if you need detailed performance data from your tests. 10 ```bash 11 kubectl apply -f examples/k6-executor.yaml 12 13 # see https://k6.io/docs/results-visualization/influxdb-+-grafana/ 14 kubectl apply -f examples/k6-influxdb-grafana.yaml 15 ``` 16 17 Have a look at the [k6 documentation](https://k6.io/docs/getting-started/running-k6/) for details on writing tests. Here is a simple example script: 18 ```javascript 19 import http from 'k6/http'; 20 import { sleep } from 'k6'; 21 22 export default function () { 23 http.get('https://docs.testkube.io'); 24 sleep(1); 25 } 26 ``` 27 28 Issue the following commands to create and start the script: 29 ```bash 30 kubectl testkube create test --file examples/k6-test-script.js --type "k6/script" --name k6-test-script 31 kubectl testkube run test --watch k6-test-script 32 ``` 33 34 ## Examples 35 36 ``` 37 # run k6-test-script.js from this Git repository 38 kubectl testkube create test --git-uri https://github.com/kubeshop/testkube-executor-k6.git --git-branch main --git-path examples --type "k6/script" --name k6-test-script-git 39 kubectl testkube run test --args examples/k6-test-script.js --watch k6-test-script-git 40 41 # for local k6 execution use k6/run or k6/script (deprecated) 42 kubectl testkube create test --file examples/k6-test-script.js --type "k6/run" --name k6-local-test 43 44 # you can also run test scripts using k6 cloud 45 # you need to pass the API token as test param 46 kubectl testkube create test --file examples/k6-test-script.js --type "k6/cloud" --name k6-cloud-test 47 kubectl testkube run test --param K6_CLOUD_TOKEN=K6_CLOUD_TOKEN=<YOUR_K6_CLOUD_API_TOKEN> --watch k6-cloud-test 48 49 ``` 50 51 # Issues and enchancements 52 53 Please follow the main [TestKube repository](https://github.com/kubeshop/testkube) for reporting any [issues](https://github.com/kubeshop/testkube/issues) or [discussions](https://github.com/kubeshop/testkube/discussions) 54 55 # Testkube 56 57 For more info go to [main testkube repo](https://github.com/kubeshop/testkube) 58 59  [](https://github.com/kubeshop/testkube/tags?label=Downloads)  60 61    62 63   64 #### [Documentation](https://docs.testkube.io) | [Slack](https://testkubeworkspace.slack.com/join/shared_invite/zt-2arhz5vmu-U2r3WZ69iPya5Fw0hMhRDg#/shared-invite/email)