Gitlab runner setup in EKS cluster: KUBERNETES_MASTER error

I’m trying to deploy a new gitlab runner in our own EKS cluster using Terraform.
The Terraform code I use was working fine, I could register a new runner and use it very quickly.
However I tried to register a new runner today and I got this error:

ERROR: Preparation failed: getting Kubernetes config: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable

I got this error in the past and I believe it was due to a version matching error between the runner version and the app version.
I tried installing a few different versions of the runner but it still doesn’t work.

Any help would be appreciated.

We finally figured it out.
We used a terraform resource to create our service account. However the automount token variable was set to false. Fixing this fixed our issue.