Configure Gitlab Kubernetes executor for Docker-in-Docker

--

Getting the kubernetes executor to run docker-in-docker kind of job can be a bit tricky. The documentation is a bit hard to get around. In this little guide I will show you how to do it and hopefully it will save you a bunch of head scraching.

First of all we would install the gitlab-runner on the kubernetes cluster with the help on an helm chart. For that we can follow this guide: https://docs.gitlab.com/runner/install/kubernetes.html#configuring-gitlab-runner-using-the-helm-chart

Here’s below the value file for this chart. The magic part is the volumes mounting part :

gitlabUrl: "https://gitlab.com/"
runnerRegistrationToken: <your-gitlab-registration-token>

runners:
config: |
[[runners]]
[runners.kubernetes]
image = "busybox"
privileged = true
[[runners.kubernetes.volumes.host_path]]
name = "docker"
mount_path = "/var/run/docker.sock"
host_path = "/var/run/docker.sock"

Here you have it !

--

--

Julien SEVERIN
Julien SEVERIN

Written by Julien SEVERIN

0 Followers

DevOps Engineer

Responses (1)