Error while deploying K6 on Kubernetes

I am using the following guide to deploy K6 and run tests on a Kubernetes Cluster.

I can notice that it is not working properly. All the pods created by jobs are failing. The error message is :

level=error msg="The moduleSpecifier \"/test//home/ubuntu/perfomance/index.js\" couldn't be found on local disk.

There is no directory called /test. I am not able to get it.

Hi @kapil,

That tutorial is a bit outdated but mostly correct and should continue to work, so some additional info is needed before I can help you. What command have you used to create a configmap and how does the configmap look like now? E.g. if you use more than one .js file for your scripting, all of them must be present in the configmap: this is not the case described in tutorial but it is described in the README, Mutli-file tests section. Also, how did you specify your yaml?

Could you provide these please? Thanks.

Hi. The command I used to create configmap is:

kubectl create configmap {map-name} --from-file index.js

The kubectl configmap describe cmd is working. The file index.js calls multiple .js files from inside. So in order to include all of them can I use

kubectl create configmap scenarios-test --from-file=./{my-repo-dir}

Will this work?

If I need to execute those tests using the K6 docker image, can I use

kind: K6
  name: k6-sample
  parallelism: 4
    localFile: /test/test.js
    image: {latest k6 docker image}

My repo structure goes like this. An index.js file on the root folder which calls different .js files from other folders. Could you please help me on this?

It should work :slightly_smiling_face: If it doesn’t, please let me know the details.

As for the localFile, you can use that too of course but it is not the recommended way: you need to build your own custom image for that and it was added for the cases when neither Configmap nor VolumeClaim can be used.