Gitlab Kubernetes runner with Docker in Docker
Contents
Docker in Docker (DIND) is a powerful tool for running Docker containers within Docker containers. This allows developers to easily create and test Docker images within a container environment that closely resembles the production environment. This can help to catch issues early in the development process and ensure that the application is running as expected in the production environment
DinD config for kubernetes runner
All examples stored in repo
Register and deployGitlab Runner
- Create new runner in Gitlab UI [USER] > [REPO] > [CI/CD Settings] > [New runner].
Save
<token>
, and assign tags (for exampledind
to use it later) - Deploy the runner to k8s
1 2 3 4 5 6 7 8 9
kubectl create ns gitlab helm repo add gitlab https://charts.gitlab.io/ helm repo update helm upgrade -i gitlab-runner \ --set gitlabUrl=https://gitlab.com,runnerRegistrationToken=<token> \ gitlab/gitlab-runner \ -n gitlab \ -f values.yaml
Gitlab job manifest
Gitlab needs additional variables like DOCKER_HOST
, DOCKER_TLS_CERTDIR
, see working example below
|
|