![How to install gitlab runner on kubernetes](https://knopkazmeya.com/12.png)
- #How to install gitlab runner on kubernetes how to#
- #How to install gitlab runner on kubernetes registration#
- #How to install gitlab runner on kubernetes code#
#How to install gitlab runner on kubernetes registration#
runnerRegistrationToken - The Registration Token for adding new Runners to the GitLab Server.gitlabURL - the GitLab Server URL (with protocol) to register the runner against.In order for GitLab Runner to function, your config file must specify the following: The default configuration can always be found in the values.yaml in the chart repository. See Helm docsįor information on how your values file will override the defaults. See Adding GitLab Helm RepoĬonfiguring GitLab Runner using the Helm ChartĬreate a values.yaml file for your GitLab Runner configuration. The GitLab Helm Repo added to your Helm Client.The Helm Server (Tiller) already installed and running in the cluster, by running helm init.The kubectl CLI installed locally and authenticated for the cluster.Your GitLab Server's API is reachable from the cluster.New pod within the specified namespace to run it. For each new job it receives from GitLab CI, it will provision a.Run using the GitLab Runner Kubernetes executor.The gitlab-runner Helm chart deploys a GitLab Runner instance into your Officially supported schedulers are Kubernetes and Terraform. You can check out our article about Kubernetes productivity tips and tricks to go further on pipeline improvement.Officially supported cloud providers are Google Container Service and Azure Container Service. If you are still indecisive between use GitLab pipeline or GitHub and CodeBuild this article can help you form your own opinion. gitlab-ci.yml to deploy your Kubernetes app using Gitlab-CI! Gitlab also provide a Kubernetes integration tools which allow you to manage and monitor your cluster using the GitLab interface! Your runner and pipeline are now ready, you just have to add the previous job to your. You can note the tags notation is used to select the kubernetes runner you just deployed.
![how to install gitlab runner on kubernetes how to install gitlab runner on kubernetes](https://blog.mayadata.io/hs-fs/hubfs/0_6OJs4Yw_0sAJ3yw5.png)
There is one condition to deploy your project with the job I showed you, your project must use Helm and so you need a path to your Helm Chart.
![how to install gitlab runner on kubernetes how to install gitlab runner on kubernetes](https://i1.wp.com/aymen-segni.com/wp-content/uploads/2020/02/deploying-production-ready-gitlab-on-gke-architecture.png)
Deploy your Kubernetes app with the pipeline Your gitlab runner should be running in your Kubernetes cluster and you should see it inside the Gitlab interface. Fill in the previous values.yaml with your own values and then execute the 2 commands below: You must have Helm already set up in your cluster (Tiller side for Helm 2.x) before executing the following steps. Here is the simplified values.yaml for the helm chart: It can be deployed in a few minutes with the official Helm Chart and allows you to leverage the serviceAccount capabilities of Kubernetes in order to avoid handling authentication with API server directly in your CI. To deploy your app on your Kubernetes cluster it’s a good idea to have a gitlab runner as a pod. To deploy this kind of runners you will find more information in the GitLab documentation. It’s a good practice to use runners as docker+machine to execute test and build stages as they use more resources.
#How to install gitlab runner on kubernetes how to#
What runners do I need and how to deploy them? For example, you can use it to link db instances for your tests or using docker-in-docker as I did. I also set up a service in the second job: a service is a Docker image linked to your job and executed at the same time.
![how to install gitlab runner on kubernetes how to install gitlab runner on kubernetes](https://miro.medium.com/max/1280/1*cmg385oq6QDEvOGmzZfdtQ.png)
When you run a job, you can choose to use the default runner image or to execute your job in a specific image: in my example, the lint-test job is ran inside a node:11.10.1 image. You can have several runners and differentiate them using tags and assign specific jobs or projects to them. Gitlab-runners can be a process running on a VM, a pod in Kubernetes and even scale as you need to use them. It is the process that executes your jobs.
![how to install gitlab runner on kubernetes how to install gitlab runner on kubernetes](https://miro.medium.com/max/1280/1*8As_qdqEKXh0IaeBQM6S7g.png)
To understand the remaining parts of this CI, you must know what a gitlab-runner is. You can notice that I don’t have a single job in the deploy stage: I will show it to you in the last part of this tutorial.
#How to install gitlab runner on kubernetes code#
In this example, they are executed every time you push some code in your repository, but Gitlab allows you to add filter: execute a step on a specific branch, tag and even trigger it manually. Stages are executed sequentially following the defined order, and if there are several jobs for one stage, they are executed in parallel. I also have 2 jobs which belong to the stages: lint-test and build-push (they could be named after their stage but I choose to name them accordingly to their actions). Here is an example:Īs you can see, I defined here 3 stages: test, build and deploy. This file contains the different steps of your pipeline. Firstly, I need to explain how GitLab pipeline works.
![How to install gitlab runner on kubernetes](https://knopkazmeya.com/12.png)