Given that the ENTRYPOINT
to the k6 docker image is the k6
binary itself, I’m wondering if there has been any documented efforts of how best to run k6
from a k8s cluster. I have a few ideas, but I’m finding nothing on t3h g00gles when I search for anyone else having gone through this as well.
Ideally this will become part of our CI/CD pipeline, meaning that pull requests in our team’s codebase will trigger specific tests to be run in an environment that mirrors production from an infrastructure resource capacity standpoint (for us, that’s our UAT environment). Given that, here are my ideas:
- Deploying k6 as a Job. This approach requires some mechanism to get the test script loaded into the job’s local file system for k6 to access.
- Deploying k6 as a Deployment/ReplicaSet. This approach requires overriding the
ENTRYPOINT
of the k6 docker image viacommand: ["some-command"]
syntax in the deployment yaml file. Test scripts could be written asConfigMap
’s orSecret
’s and attached to the image asvolumes
. Once deployed, I would SSH into the container and manually runk6
with the mounted scripts. This approach is definitely the most “hacky”. - Copy a pre-built
k6
binary onto our running Jenkins instance, and incorporate it into the build script for our UAT deployments. This might be the best solution, but would definitely require me to beef up the resources on our Jenkins container to handle the load tests with higher VU counts. This adds some extra complexity around auto-scaling resources since we don’t want a huge amount of RAM allocated 100% of the time (huge $$$).
Anyway, would love to hear everyone else’s thoughts on these approaches, and of their own approaches. Thanks!