Installing the GitLab Agent
The GitLab Agent is used to connect a Managed Service for Kubernetes cluster to GitLab. You can deploy the application in a Yandex Managed Service for GitLab instance or in a standalone GitLab instance.
The GitLab Agent enables you to:
- Work with Managed Service for Kubernetes clusters behind NAT.
- Get real-time access to the Managed Service for Kubernetes cluster API.
- Receive information about events in a Managed Service for Kubernetes cluster.
- Activate the cache of Kubernetes objects, which are updated with very low latency.
Note
The GitLab Agent does not execute CI/CD pipelines. To do this, install GitLab Runner.
Getting started
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To install the GitLab Agent:
- Create a Managed Service for GitLab instance or a standalone instance.
- Create an agent configuration file in the repository:
- Open your GitLab instance and go to your project.
- In the
main
branch, create a new.gitlab/agents/<GitLab_agent_name>
folder. - In the
<GitLab_agent_name>
folder, create an emptyconfig.yaml
file.
- Register the agent in GitLab and get an access token:
- Open your GitLab instance and go to your project.
- Click Infrastructure and select Kubernetes clusters.
- Click Connect a cluster and select the agent name:
<GitLab_agent_name>
. - Click Register.
- GitLab will create a token required to install the application. Store the token in a secure place.
Note
For more information about setting up and registering an agent, see the GitLab documentation
Installation using Yandex Cloud Marketplace
- Go to the folder page
and select Managed Service for Kubernetes. - Click the Managed Service for Kubernetes cluster name and select the
Marketplace tab. - Under Applications available for installation, select GitLab Agent and click Use.
- Configure the application:
- Namespace: Select a namespace or create a new one.
- Application name: Enter a name for the application, e.g.,
gitlab-agent
. - GitLab domain name: Enter the name of your GitLab domain, e.g.,
gitlab-test.gitlab.yandexcloud.net
. - Agent access token: Paste the GitLab access token you received earlier into this field.
- Click Install.
- Wait for the application status to change to
Deployed
. - Open your GitLab instance and go to Infrastucture → Kubernetes clusters. Make sure the agent status changed to
Connected
.
Installation using a Helm chart
-
Install Helm
v3.7.0 or higher. -
Install kubectl
and configure it to work with the created cluster. -
To install a Helm chart
with the GitLab Agent, run the following command:export HELM_EXPERIMENTAL_OCI=1 && \ helm pull oci://cr.yandex/yc-marketplace/yandex-cloud/gitlab-org/gitlab-agent/chart/gitlab-agent \ --version 1.16.0-1 \ --untar && \ helm upgrade --install \ --namespace <namespace> \ --create-namespace \ --set config.kasAddress='wss://<your_GitLab_domain_name>/-/kubernetes-agent/' \ --set config.token='<GitLab_access_token>' \ gitlab-agent ./gitlab-agent/
This command also creates a new namespace required for the application.
-
Make sure the GitLab Agent pod status changed to
Running
:kubectl get pods --namespace gitlab-agent
-
Open your GitLab instance and go to Infrastucture → Kubernetes clusters. Make sure the agent status changed to
Connected
.