Skip to main content

Gitlab agent for Kubernetes

· 2 min read
Mohammad Zakery

Installing the agent for Kubernetes

Gitlab Agent

Installation steps

To install the agent in your cluster:

1.Create an agent configuration file.

2.Register the agent with GitLab.

3.Install the agent in your cluster.

Create an agent configuration file

1.In the repository, in the default branch, create an agent configuration file at the root.


You can leave the file blank for now, and configure it later.

Register the agent with GitLab

1.On the left sidebar, at the top, select Search GitLab () to find your project. If you have an agent configuration file, it must be in this project. Your cluster manifest files should also be in this project.

2.Select Operate > Kubernetes clusters.

3.Select Connect a cluster (agent).

4.Select Register an agent.

5.Copy the generated command.

Install the agent in the cluster

1.Run the command you copied to install agent with helm.


If you see errors on the pods built in Kubernetes, use the following method.

Adding additional entries with hostAliases

In addition to the default boilerplate, you can add additional entries to the hosts file. For example: to resolve foo.local, bar.local to and foo.remote, bar.remote to, you can configure HostAliases for a Pod under .spec.hostAliases:

apiVersion: v1
kind: Pod
name: hostaliases-pod
restartPolicy: Never
- ip: ""
- "foo.local"
- "bar.local"
- ip: ""
- "foo.remote"
- "bar.remote"
- name: cat-hosts
image: busybox:1.28
- cat
- "/etc/hosts"