I have some GitLab pipelines which are using Kubernetes pods in EKS
I had some issues initially with token registration which was solved by resetting the token on GitLab and replacing it in gitlab-runner-secret
I do specify that I used for encoding
echo -n <key> | base 64
Now, I can see that the token registration is successfully, but I encounter the following error
ERROR: Job failed (system failure): prepare environment: Post https://xxx/api/v1/namespaces/kube-system/secrets: net/http: invalid header field value "Bearer \xbd\xxx" for key Authorization.
If possible, I would make a step which:
You need to make sure the token does not contain any newlines or other special trailing characters (like an invisible stray Unicode character).
Check also if you can (or have) managed your Kubernetes secrets through a Sealed Secrets controller.