Issue running kuttl in a gitlab runner
Hello,
I'm trying to run kuttl in CI context using gitlab CI/CD.
In this context kuttl is launched in a gitlab runner running in a kubernetes cluster and I want to run my tests in a different kubernetes cluster. When launching the kubectl kuttl test command in this context I'm getting this error:
$ kubectl kuttl test
=== RUN kuttl
harness.go:457: starting setup
harness.go:248: running tests using configured kubeconfig.
harness.go:508: cleaning up
harness.go:563: removing temp folder: ""
harness.go:589: fatal error getting client: open /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory
--- FAIL: kuttl (0.00s)
FAIL
Other kubectl commands are working fine. The tests pass when launched with the same docker image and using the same kubeconfig but launched using docker desktop.
Do you have any idea how to solve my problem ?
Thank you !
I assume by reading the code that when kuttl is run from a kubernetes pod it tries to deploy the tests on the same cluster but that's not what I want to do. Does someone have an idea about how to fix that, I don't think it should work like that.
Hi @max-l-f, could you share your kuttl-test.yaml? This can be useful to understand what is happening.
Also, what KUTTL version are you using?
Hi, kuttl-test.yaml:
apiVersion: kuttl.dev/v1beta1 kind: TestSuite testDirs:
- ./test/integration
kuttl version: 0.11.1
I forced the kuttl step to run on a docker engine instead of kubernetes and it works fine but I still have the issue when it runs in a kubernetes pod.
hmm... we run kuttl in docker images for operator sdk scorecard. I think we need more information but will take a look
ah... @max-l-f I believe the scorecard is running in the same cluster and that is assumed for sure. So you are running in 1 cluster and wanting to test another cluster. I'm not sure we have ever looked at that.. that detail is likely the important part of this submission. Thanks for the report!
yes exactly I can't choose the cluster from which the test are launched
This workaround seems to work for me though I don't love it
# mkdir -p /var/run/secrets/kubernetes.io/serviceaccount
# echo "not-actually-used" > /var/run/secrets/kubernetes.io/serviceaccount/token
# KUBECONFIG=~/.kube/config kuttl test