Commit c818f4b1 authored by Steve Grossman's avatar Steve Grossman 💬

Incorporate feedback from MR with topic overview, individual sections for each...

Incorporate feedback from MR with topic overview, individual sections for each activity and general rewording and restructuring for clarity and readability.
parent 37995c04
Pipeline #48090079 passed with stages
in 29 minutes and 30 seconds
# Run GitLab Runner on a Kubernetes cluster
To get started with the GitLab CI Runner on Kubernetes you need to define
resources that you can then push to the cluster with `kubectl`.
To install the GitLab CI Runner on Kubernetes there are several resources that need to be defined and then pushed to the cluster with `kubectl`. This topic covers how to:
1. Define the runner ConfigMap in a yaml file
1. Define the runner Deployment yaml file
1. Push the definitions to a Kubernetes cluster using `kubectl`
A recommended approach to this is to create a `ConfigMap` in Kubernetes such as
the following:
## Define the Runner `ConfigMap`
Create a file named `runner_config.yml` from the following example:
```yaml
apiVersion: v1
......@@ -26,24 +29,22 @@ data:
image = "busybox"
```
Where `image` (optional) is the default Docker image to run jobs on top of.
Put this config map in a file named `runner_config.yml` and run the command
`kubectl apply -f runner_config.yml`.
Update the url and token with your values. The parameter `image` is optional and is the default Docker image used to be used to run jobs.
>**Note:**
The `token` can be found in `/etc/gitlab-runner/config.toml` and should
>**Notes:**
>* The `token` can be found in `/etc/gitlab-runner/config.toml` and should
have been generated after registering the Runner. It's not to be confused
with the registration token that can be found under your project's
**Settings > CI/CD > Runners settings**. Alternatively, you can obtain the
runner token using the GitLab API
**Settings > CI/CD > Runners settings**.
>* Alternatively, you can obtain the runner token using the GitLab API
`curl -X POST https://gitlab.com/api/v4/runners --form "token=<registration-token>"`
where `<registration token>` is obtained from the **Settings > CI/CD > Runners settings**.
where `<registration token>` is obtained from the **Settings > CI/CD > Runners settings**.
>* It is not recommended to use the gitlab-managed-apps namespace for this runner, that namespace should be reserved for applications installed through the GitLab UI.
## Define the Runner `Deployment`
Then create a `Deployment` or `ReplicationController` which uses the `ConfigMap`.
This is an example of a `Deployment`:
Create a file named `runner_deployment.yml` from the following example:
```yaml
apiVersion: extensions/v1beta1
......@@ -82,7 +83,12 @@ spec:
name: cacerts
```
Put this deployment in a file named `runner_deployment.yml` and run the command
## Push the definitions to Kubernetes
Assuming that your kubectl context has already been set to the cluster in question, issue these commands:
`kubectl apply -f runner_config.yml`.
`kubectl apply -f runner_deployment.yml`.
For more details see [Kubernetes executor](../executors/kubernetes.md)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment