Skip to main content

Day 6: MicroK8s Integration with GitLab Runner using Helm

Updated 2 min readMarkdown
Day 6: MicroK8s Integration with GitLab Runner using Helm

πŸ“Œ This document is prepared with the help of official GitLab and Helm documentation.


βœ… Step 1: Install Helm

Install Helm using Snap:

snap install helm --classic

βœ… Step 2: Add the GitLab Helm Repository

helm repo add gitlab https://charts.gitlab.io

Update the repository:

helm repo update gitlab

βœ… Step 3: Check Available GitLab Runner Chart Versions

helm search repo -l gitlab/gitlab-runner

Sample output:

NAME                    CHART VERSION   APP VERSION     DESCRIPTION
gitlab/gitlab-runner    0.74.0          17.9.0          GitLab Runner
gitlab/gitlab-runner    0.73.3          17.8.3          GitLab Runner
gitlab/gitlab-runner    0.73.2          17.8.2          GitLab Runner
gitlab/gitlab-runner    0.73.1          17.8.1          GitLab Runner
gitlab/gitlab-runner    0.73.0          17.8.0          GitLab Runner
gitlab/gitlab-runner    0.72.1          17.7.1          GitLab Runner
gitlab/gitlab-runner    0.72.0          17.7.0          GitLab Runner

βœ… Step 4: Prepare the helm_values.yaml for Runner Configuration

Create a file named helm_values.yaml with the following content:

concurrent: 5
logFormat: json

rbac:
  create: true
  rules:
    - apiGroups: [""]
      resources: ["configmaps", "events", "pods", "pods/attach", "pods/exec", "secrets", "services"]
      verbs: ["get", "list", "watch", "create", "patch", "update", "delete"]

runners:
  config: |
    [[runners]]
      [runners.kubernetes]
        namespace = "{{.Release.Namespace}}"
        image = "alpine"

βœ… Step 5: Register the GitLab Runner

Go to GitLab Admin > Runners and get your GitLab URL and Registration Token.

Register the runner:

gitlab-runner register \
  --url https://<Your-GitLab-URL> \
  --token <Your-Token>

πŸ”Ž Note: Save the URL and token. You'll need them in the next step.


βœ… Step 6: Install the GitLab Runner using Helm

Apply the Helm chart with the following command:

microk8s.helm install \
  --namespace gitlab-runner \
  --create-namespace \
  --atomic \
  --timeout 120s \
  --set gitlabUrl=https://<Your-GitLab-URL> \
  --set runnerToken=<Your-Token> \
  --values helm_values.yaml \
  gitlab-runner gitlab/gitlab-runner \
  --version 0.74.0

βœ… Step 7: Verify the GitLab Runner Pod in MicroK8s

Check the deployed runner pod:

microk8s.kubectl get pod -n gitlab-runner

Sample Output:

NAME                             READY   STATUS    RESTARTS   AGE
gitlab-runner-7f957d884f-frb59   1/1     Running   0          5m51s

πŸŽ‰ GitLab Runner successfully integrated with MicroK8s!

Your GitLab Runner is now up and running, ready to execute your CI/CD pipelines within your MicroK8s Kubernetes cluster. βœ…

About the author

  • Hey there! I'm currently working as an Associate DevOps Engineer, and I'm diving into popular DevOps tools like Azure Devops,Linux, Docker, Kubernetes,Terraform and Ansible. I'm also on the learning track with AWS certifications to amp up my cloud game. If you're into tech collaborations and exploring new horizons, let's connect!

No comments yet. Be the first to comment.

More from this blog