What does the K6 Operator's Starter pod do?

Apologies for the ignorance, but I cannot find it anywhere in the docs or READMEs that explain what the starter pod actually does. I tried pouring through the code, but figured I’d get further here.

So I have some questions:

  1. What does the K6 Operator’s starter pod do, in detail? What is it used for?
  2. If I define environment variables for the runner pod which configure some k6 settings, like pre-allocated VUs, do I also need to define the same env vars for the starter pod to ensure both starter and runner pods consider the test script within the same context?

Hi @charlieb41a, welcome to the community forum!

I am not a k6-operator expert, but if I understand it correctly, k6-operator first starts the initializer pod (which runs a k6 inspect command), then creates the runner pods according to the parallelism attribute. The runner pods are created in paused state. The runner pods will do the distributed load test with k6. After all the runners are created, k6-operator creates the starter pod, which will call all the runner pod with curl on a specified port to start the k6. So I think you needn’t to define the env vars to the starter pod, because it will not use it for the curl commands.

Thanks for the info! That helps my understanding a bit. I didn’t realize there was an initializer pod, and when I saw it get created I assumed it was the starter pod. So perhaps my second question should actually be asked in regards to the initializer pod.

Right now my initializer pod is exiting with this error:

level=error msg="There were problems with the specified script configuration:\n\t- scenario my-scenario has configuration errors: the number of preAllocatedVUs can't be negative"

This is because the preAllocatedVUs is configured via an ENV var which is being passed into the runner pod’s config, but is not being passed into the initializer pod’s config. It seems from my end, the initializer will need access to ENV vars being passed in the runner since the initializer inspects certain k6 settings like this.

Can you confirm whether this is accurate or not? Or perhaps some ENV vars, like ones that set the preAllocatedVUs value, can be omitted from the runner whereas they’re needed in the initializer?

Yes. I think you should pass that environment variable to the initializer also.

1 Like