Installing the agent for Kubernetes
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.
.gitlab/agents/<agent-name>/config.yaml
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.
Error
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 127.0.0.1 and foo.remote, bar.remote to 10.1.2.3, you can configure HostAliases for a Pod under .spec.hostAliases:
apiVersion: v1
kind: Pod
metadata:
name: hostaliases-pod
spec:
restartPolicy: Never
hostAliases:
- ip: "127.0.0.1"
hostnames:
- "foo.local"
- "bar.local"
- ip: "10.1.2.3"
hostnames:
- "foo.remote"
- "bar.remote"
containers:
- name: cat-hosts
image: busybox:1.28
command:
- cat
args:
- "/etc/hosts"
FINISH.