Gitlab runners in K8s Helm (Working DockerInDocker)

So… I spent alot of time trying to get gitlab runners working in kubernetes. using the helm from gitlab.
This is the setup i use now that works for me aand that you dont need to put to mutch inte the build job.

Replace so you have your domain and key

name the file runners1-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:// .booli.se/
name: "K8s INT"
## The registration token for adding new Runners to the GitLab server. This must
## be retrieved from your GitLab instance.
## ref: https://docs.gitlab.com/ee/ci/runners/
##
runnerRegistrationToken: ""

## Set the certsSecretName in order to pass custom certificates for GitLab Runner to use
## Provide resource name for a Kubernetes Secret Object in the same namespace,
## this is used to populate the /etc/gitlab-runner/certs directory
## ref: https://docs.gitlab.com/runner/configuration/tls-self-signed.html#supported-options-for-self-signed-certificates
##
#certsSecretName:

## Configure the maximum number of concurrent jobs
## ref: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-global-section
##
concurrent: 10

## Defines in seconds how often to check GitLab for a new builds
## ref: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-global-section
##
checkInterval: 2

## For RBAC support:
rbac:

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

## If RBAC is disabled in this Helm chart, use the following Kubernetes Service Account name.
##
serviceAccountName: gitlab-runner-admin

## Configuration for the Pods that the runner launches for each new job
##
metrics:
enabled: true

runners:
## Default container image to use for builds when none is specified
##
image: docker:19.03.13
config: |
[[runners]]
environment = ["DOCKER_HOST=tcp://docker:2376", "DOCKER_TLS_CERTDIR=/certs", "DOCKER_TLS_VERIFY=1", "DOCKER_CERT_PATH=/certs/client"]
[runners.kubernetes]
image = "docker:19.03.13"
privileged = true
cpu_request = "100m"
memory_request = "128Mi"
helper_cpu_request = "200m"
[runners.kubernetes.node_selector]
gitlab = "true"
[[runners.kubernetes.volumes.empty_dir]]
name = "docker-certs"
mount_path = "/certs/client"
medium = "Memory"





## Run all containers with the privileged flag enabled
## This will allow the docker:stable-dind image to run if you need to run Docker
## commands. Please read the docs before turning this on:
## ref: https://docs.gitlab.com/runner/executors/kubernetes.html#using-docker-dind
##
tags: "int,k8s,dind"
## Namespace to run Kubernetes jobs in (defaults to 'default')
##
namespace: gitlab
nodeSelector:
gitlab: true
## Build Container specific configuration
##
kubernetes:
node_selector:
gitlab = "true"
builds:
cpuLimit: 2000m
memoryLimit: 2048Mi
cpuRequests: 100m
memoryRequests: 128Mi
node_selector: gitlab=true
## Service Container specific configuration
##
services:
# cpuLimit: 200m
# memoryLimit: 256Mi
cpuRequests: 100m
memoryRequests: 128Mi

## Helper Container specific configuration
##
helpers:
# cpuLimit: 200m
# memoryLimit: 256Mi
cpuRequests: 100m
memoryRequests: 128Mi
node_selector: gitlab=true


Apply it with

#!/bin/bash
helm repo add gitlab https://charts.gitlab.io
helm repo update

kubectl create namespace gitlab
kubectl apply -f gitlab-service-account.yaml

helm upgrade --install --namespace gitlab gitlab-runner -f runners1-values.yaml gitlab/gitlab-runner


And now you have it wokring fine in the cluster