How to import custom files from persistent volume claim to k6 operator

Hi,
I want to import a .txt file with requests (stored inside a persistent volume claim) into my k6 operator. Is this possible?

I am creating a configmap from my test script file and applying the k6 operator that references the configmap, but I am struggling to import the .txt file into my test.

Also to mention, .txt file is arround 100Mb so it can’t be referenced as configmap, since it’s too big for that.

1 Like

Hi @nebojsamarjanovic6,

Welcome to our community forums! :tada:

I’m not an expert on this topic (k8s, nor the k6-operator), so I cannot help here. But let me assign this thread to our expert @olhayevtushenko, and see if they can shed some light.

Note that this may take a bit longer than usual, cause we’re in the middle of a festivity period, and I don’t know their availability to help with this. But I hope they will eventually do :crossed_fingers:

Regards!

Thanks @joanlopez!

Hi @nebojsamarjanovic6 :wave:
Can you have your script stored in the volume as well? If yes, then the easiest would be to switch to this configuration:

If for some reason you need to keep the script separately in a ConfigMap, then you can also mount volumes directly to runners with .spec.runner.volume and .spec.runner.volumeMounts. These options should be fully specified as is usually done in Kubernetes, ref. docs.

Hope that helps!

1 Like

Yes, you can import the .txt file into your k6 test by mounting the PVC where the file is stored directly into the k6 pod. Since the file is too large for a ConfigMap, use the PVC to provide access to the IPA file within your test script. Simply reference the mounted file path in your script.