Distributed k6 tests on Kubernetes on Azure Kubernetes Services

Hello,
I test Distributed k6 test on Kubernetes with AKS, but I have problem after:

kubectl apply -f /path/to/our/k6/custom-resource.yml

message is:
The K6 “k6-sample” is invalid: spec.script: Invalid value: “string”: spec.script in body must be of type object: “string”

I tried it on our own kubernetes cluster, it works, but in AKS not. I hope I try everything, but without solution. Would anyone know?

Regards,
Jan Sevela

Hi, welcome to the forum, and sorry about the late reply, we don’t have a lot of AKS users here.

I’m not familiar with it myself, but can you confirm you’re using the same Kubernetes version locally and on AKS?

Maybe @simme as the author of k6 operator has a better idea. Or you might want to open an issue about it.

Hi,

The article is a little bit outdated unfortunately. The current syntax for specifying the script location when using configmaps is:

  script: 
    configMap: 
      name: name-of-the-config-map
      file: name-of-the-script-file-inside-the-configmap.js

Hope that helps!

Best,
Simme

@simme your solution isnt working either. I have also hit the same error

error:
The K6 “k6-sample” is invalid: spec.script: Invalid value: “string”: spec.script in body must be of type object: “string”

After putting your solution:

Error:

The K6 “k6-sample” is invalid:

  • spec.parallelism: Required value
  • spec.script: Required value

My custom-resource.yaml file with your solution

apiVersion: k6.io/v1alpha1
kind: K6
metadata:
name: k6-sample
spec:
configMap:
parallelism: 4
name: crocodile
file: test.js

Can you help me asap?