GitLab Runner Setup — CI/CD on AKS (Azure Kubernetes Service)

Runners are processes that pick up and execute jobs for GitLab. You can install the runner manually on your local machine, using docker on your local machine, a VM or automatically on a Kubernetes cluster.

The following steps should help you register an AKS cluster with GitLab and then install the agent on the cluster, and then register the agent with GitLab. I’m using GitLab Enterprise Edition 13.2.4–ee.

Firstly create an AKS cluster on Azure, once complete you’ll see something similar to below:

In Gitlab, first, enable CI/CD for the project under settings -> general -> pipelines.

You should now see a CI/CD option in the settings menu, again in the project you wish to enable CI/CD for, go to Settings -> CI/CD -> Install runner on Kubernetes:

Add Kubernetes Cluster:

Add existing cluster tab and fill in the details as follows:

  1. Kubernetes cluster name (required) — The name you wish to give the cluster.
  2. Environment scope (required) — The associated environment to this cluster.
  3. API URL (required) — Get this from the Azure portal and add https:// in front of the URL, e.g. kubegitlabrunner-dns-322ea5bc.hcp.uksouth.azmk8s.io
  4. CA certificate (required) — A valid Kubernetes certificate is needed to authenticate to the cluster. We will use the certificate created by default.
  • Connect to the Kubernetes Cluster, hit connect in the portal to get the commands to run in azure cloud shell.

#gitlab #azure #ci-cd-pipeline #kubernetes #gitlab runner

5.35 GEEK