Gitlab Runner Kubernetes docker.sock bind configuration

I am trying to achieve this but none of my configurations seems to work.

I have tried specify environment variables for docker.sock bind as well as tried to specify custom config.toml (it seems to produce duplicate entries for some reason so I am not sure if it got configured as it should) but none of this worked.

I am using this helm chart for deploying runner in Kubernetes cluster

This is the custom values I provide for helm chart. Rest of values are same as values specified in chart values.yaml

## The GitLab Server URL (with protocol) that want to register the runner against
## ref: https://docs.gitlab.com/runner/commands/README.html#gitlab-runner-register
##
gitlabUrl: https://gitlab.com/

## The Registration Token for adding new Runners to the GitLab Server. This must
## be retreived from your GitLab Instance.
## ref: https://docs.gitlab.com/ce/ci/runners/README.html#creating-and-registering-a-runner
##
# runnerRegistrationToken: ""
runnerRegistrationToken: "my-token"


## For RBAC support:
rbac:
  create: true

  ## Run the gitlab-bastion container with the ability to deploy/manage containers of jobs
  ## cluster-wide or only within namespace
  clusterWideAccess: false

  ## Use the following Kubernetes Service Account name if RBAC is disabled in this Helm chart (see rbac.create)
  ##
  # serviceAccountName: default

## Configuration for the Pods that that the runner launches for each new job
##
runners:
  ## Default container image to use for builds when none is specified
  ##
  image: docker:stable

## Configure environment variables that will be present when the registration command runs
## This provides further control over the registration process and the config.toml file
## ref: `gitlab-runner register --help`
## ref: https://docs.gitlab.com/runner/configuration/advanced-configuration.html
##
envVars:
  - name: DOCKER_VOLUMES
    value: /var/run/docker.sock:/var/run/docker.sock

Note envVars DOCKER_VOLUMES. Supposedly this should instruct runner pod to have host docker socket mounted within it but for some reason I can’t make it work.

I am not running in privileged mode. I am able to run gitlab runner with dind but I want to use docker socket bind with host node instead of dind,

I solved it by following workaround by Benoit from https://gitlab.com/gitlab-org/gitlab-runner/issues/2578

1 Like