
GitLab Runner is an open-source software system that runs CI/CD jobs and sends the results to GitLab. The runner application is installed and configured on the machine you want to use for builds. Each project in GitLab can have its own runners, and each runner is a container that can be started and stopped as you need.
Kubernetes is an open-source software system that automates applications deployment, scaling, and maintains containerized applications. It works by grouping application containers into logical units for access and management.
GitLab runner on Kubernetes is used to manage CI/CD projects. This tutorial explains how to install GitLab Runner on Vultr Kubernetes Engine.
To follow through this tutorial, you need the following:
kubectl CLI installed and configured in your machineGet the runner details from GitLab. These are the runner URL and the token. The token is used to authenticate the runner to GitLab. On your project's directory, get the details from Settings > CI/CD > Runners settings page, as shown below.
Copy the runner URL and the registration token and save them for later GitLab runner configuration.
To deploy the runner on your VKE cluster, you have to configure access to the cluster. This is done using a kubeconfig file. The kubeconfig file is used to provide access to Kubernetes API servers. It is used by kubectl and other Kubernetes components to find the appropriate API server and authenticate.
Get the kubeconfig file for your VKE cluster.
Run the following command to access your VKE cluster:
Expected output:
Create a namespace called gitlab-runner using the kubectl as shown below:
A namespace is used to isolate resources within a single Kubernetes cluster. For example, you can use namespaces to deploy multiple applications to the same cluster without interfering with each other. This helps with maintenance and future upgrades.
Obtain a copy of the Helm chart of GitLab Runner by running the command below:
Or, run the command below if you are using an ssh key.
Navigate to the cloned repository and configure your GitLab Runner in the values.yaml file as follows:
NOTE To avoid the
Readiness probe failederror, configure thetemplates\deployment.yamlfile as follows:
After configuring the Helm Chart, deploy the runner using the following command:
Expected Output:
Where:
<NAMESPACE> is the Kubernetes namespace.<PATH_TO_CONFIG_VALUES_FILE> is the path to the helm chart. In this case, *.tgz file.Check the status of the pod or deployment by running the command below:
Expected Output:
To check if the pods have been started, go to GitLab under the registered GitLab runners. The runner will be displayed as shown in the figure below.
You've finished installing GitLab Runner in Vultr Kubernetes Engine (VKE) cluster using Helm Chart. You can now manage your CD/CI projects using the runner you've just installed.
0 Comments
Be the first to comment and share your perspective with the community.