Gitlab runner in EKS

Sgaunet
2 min readMay 7, 2022

I’ve wrote another story on how to deploy a gitlab runner in swarm. But I don’t use swarm for a while now and I’m using kubernetes at work (not a big cluster).

So now, this article will give some informations on how to deploy the gitlab runner in EKS.

The first step consists to get a token to register our runner.

Register gitlab-runner

Before registering the gitlab-runner, find the token in gitlab :

  • project
  • settings -> CI/CD
  • Runners -> expand
$ mkdir conf
$ docker run -ti -v $PWD/conf:/etc/gitlab-runner gitlab/gitlab-runner:latest register
Runtime platform arch=amd64 os=linux pid=6 revision=21cb397c version=13.0.1
Running in system-mode.

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
https://gitlab.com
Please enter the gitlab-ci token for this runner:
**Set the token of your project**
Please enter the gitlab-ci description for this runner:
[xxxXXXxxxXX]: k8s devlopment cluster
Please enter the gitlab-ci tags for this runner (comma separated):
test
Registering runner... succeeded runner=xxxZEERTVDFdf
Please enter the executor: docker+machine, docker-ssh+machine, ssh, virtualbox, docker-ssh, parallels, shell, kubernetes, custom, docker:
kubernetes
Please enter the default Docker image (e.g. ruby:2.6):
dind:latest
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
$ ll conf
total 4,0K
-rw------- 1 root root 519 juin 18 21:11 config.toml

Fine, we have generated a configuration but we also have a client token associated to the server token.

It should be like this :

From this config file, it’s quite easy to create the configmap for the deployment.

On line 36 and 37, you can see the configuration to launch the gitlab-runner on a specific node. If you use AWS EKS, and have created it with eksctl, you can add this nodegroup declaration to create a nodegroup of one node in which the gitlab-runner will be executed.

Manifests

Everything you need is in this github repository : https://github.com/sgaunet/gitlab-runner

--

--