[Yandex Cloud documentation](../../index.md) > [Yandex Managed Service for GitLab](../index.md) > [Step-by-step guides](index.md) > Working with a managed runner

# Working with a managed runner

{% note info %}

The feature of creating and managing runners using the management console is at the [Preview](../../overview/concepts/launch-stages.md) stage. To request access, contact [support](https://center.yandex.cloud/support) or your account manager.

{% endnote %}

In Managed Service for GitLab, you can create a managed runner that automatically deploys a specified number of Compute Cloud [VMs](../../compute/concepts/vm.md) with installed GitLab workers. The managed runner also scales out the worker VMs to accommodate the load.

{% note warning %}

There is a fee for using VM instances (workers) (see [Compute Cloud pricing](../../compute/pricing.md)).

{% endnote %}

For the managed runner to work correctly, you need to [configure](../concepts/index.md#networking-gl-mr) the network and security groups.

## Getting a GitLab Runner token {#gitlab-token}

You can get a token when creating a GitLab Runner in GitLab. You specify this token when [creating a runner](#create) in your Managed Service for GitLab instance and use it to authenticate the runner in GitLab.

To create and configure GitLab Runner for the entire [GitLab instance](../concepts/index.md#instance), proceed as follows (GitLab admin permissions required):

1. Open GitLab.
1. In the bottom-left corner, click **Admin**.
1. In the left-hand menu, select **CI/CD** → **Runners**.
1. Click **New instance runner** and create a new GitLab Runner.
1. Save the value of the `Runner authentication token` parameter.

To create and set up GitLab Runner for a [project](https://docs.gitlab.com/ee/user/project/), proceed as follows:

1. Open GitLab.
1. Select a project.
1. In the left-hand menu, select **Settings** → **CI/CD**.
1. Under **Runners**, click **Expand**.
1. Click **New project runner** and create a new GitLab Runner.
1. Save the value of the `Runner authentication token` parameter.

## Creating a runner {#create}

{% list tabs group=instructions %}

- Management console {#console}

  1. Select the Managed Service for GitLab instance you need to create a runner for.
  1. Select the **Runners** tab.
  1. Click **Create Runner**.
  1. Enter a name for the runner:
      * The name must be 2 to 63 characters long.
      * It can only contain lowercase Latin letters, numbers, and hyphens.
      * It must start with a letter and cannot end with a hyphen.
  1. Optionally, enter a random decription for the runner.
  1. Enter the [previously obtained](#gitlab-token) GitLab Runner token.
  1. Select or create a [service account](../../iam/concepts/users/service-accounts.md) for the runner.

      {% note info %}
      
      This service account will be used only to create the VM and will not be linked to it. The service account must have the [compute.admin](../../compute/security/index.md#compute-admin), [vpc.admin](../../vpc/security/index.md#vpc-admin), and [iam.serviceAccounts.user](../../iam/security/index.md#iam-serviceAccounts-user) roles. For more information, see [Assigning roles to a service account](../../iam/operations/sa/assign-role-for-sa.md).
      
      {% endnote %}

  1. Optionally, add [labels](../../resource-manager/concepts/labels.md) to break runners into logical groups.
  1. Under **Autoscale settings**, specify:

      * **Minimum workers**: Number of workers that are always running and ready to execute jobs. Default value: `1`; minimum: `0`; maximum: `10`.
      * **Maximum workers**: Maximum number of workers that can be created to execute jobs. Default value: `3`; minimum: `1`; maximum: `30`. The maximum number of workers cannot be less than the minimum number.
      * **Maximum worker downtime, in minutes**: Maximum idle time after which the additionally created worker will be deleted. Default value: `10`; minimum: `0`.
      * **Maximum number of jobs per worker**: Maximum number of jobs after which the worker will be deleted. Default value: `100`; minimum: `0`.
      * **Number of parallel tasks per worker**: Number of parallel jobs per worker. Default value: `1`; minimum: `0`.

  1. Optionally, add labels for the worker.
  1. Under **Computing resources**, select a computing resource configuration.
  1. Under **Disks and file storages**, configure the boot disk:
      * Select the [disk type](../../compute/concepts/disk.md#disks_types).
      * Specify the disk size.
  1. Optionally, select or create a service account for the worker.

      {% note info %}
      
      This service account will be associated with the worker VM. The worker can use the account to authenticate in the Yandex Cloud API and access cloud resources.
      
      [Assign](../../iam/operations/sa/assign-role-for-sa.md) your service account a role for the resource you want to manage.
      
      {% endnote %}

  1. Optionally, select a [security group](../../vpc/concepts/security-groups.md).
  1. Click **Create**.

{% endlist %}

## Updating a runner {#update}

{% list tabs group=instructions %}

- Management console {#console}

  1. Navigate to **Managed Service for&nbsp;GitLab**.
  1. Select the Managed Service for GitLab instance containing the runner you want to update.
  1. Select the **Runners** tab.
  1. Click ![image](../../_assets/console-icons/ellipsis.svg) next to the runner and select **Edit**.
  1. Enter a new name and description for the runner.
  1. Select or create a [service account](../../iam/concepts/users/service-accounts.md) for the runner.

      {% note info %}
      
      This service account will be used only to create the VM and will not be linked to it. The service account must have the [compute.admin](../../compute/security/index.md#compute-admin), [vpc.admin](../../vpc/security/index.md#vpc-admin), and [iam.serviceAccounts.user](../../iam/security/index.md#iam-serviceAccounts-user) roles. For more information, see [Assigning roles to a service account](../../iam/operations/sa/assign-role-for-sa.md).
      
      {% endnote %}

  1. Add [labels](../../resource-manager/concepts/labels.md) to break runners into logical groups.
  1. Change the scaling settings:

      * **Minimum workers**: Number of workers that are always running and ready to execute jobs. Default value: `1`; minimum: `0`; maximum: `10`.
      * **Maximum workers**: Maximum number of workers that can be created to execute jobs. Default value: `3`; minimum: `1`; maximum: `30`. The maximum number of workers cannot be less than the minimum number.
      * **Maximum worker downtime, in minutes**: Maximum idle time after which the additionally created worker will be deleted. Default value: `10`; minimum: `0`.
      * **Maximum number of jobs per worker**: Maximum number of jobs after which the worker will be deleted. Default value: `100`; minimum: `0`.
      * **Number of parallel tasks per worker**: Number of parallel jobs per worker. Default value: `1`; minimum: `0`.

  1. Add labels for the worker.
  1. Select a new configuration of the worker computing resources.
  1. Change the [type](../../compute/concepts/disk.md#disks_types) and size of the boot disk.
  1. Select or create a service account for the worker.

      {% note info %}
      
      This service account will be associated with the worker VM. The worker can use the account to authenticate in the Yandex Cloud API and access cloud resources.
      
      [Assign](../../iam/operations/sa/assign-role-for-sa.md) your service account a role for the resource you want to manage.
      
      {% endnote %}

  1. Select the [security group](../../vpc/concepts/security-groups.md).
  1. Click **Save**.

{% endlist %}

## Deleting a runner {#delete}

{% list tabs group=instructions %}

- Management console {#console}

  1. Navigate to **Managed Service for&nbsp;GitLab**.
  1. Select the Managed Service for GitLab instance to delete the runner from.
  1. Select the **Runners** tab.
  1. Click ![image](../../_assets/console-icons/ellipsis.svg) and select **Delete** next to the runner you want to delete.
  1. In the window that opens, click **Delete**.

{% endlist %}

### See also {#see-also}

* [Managed runners](../concepts/index.md#managed-runners)
* [Deploying GitLab Runner on a Yandex Compute Cloud virtual machine](../tutorials/install-gitlab-runner.md)