gitlab-agent
by GitLab
GitLab Agent for Kubernetes is a way to integrate your cluster with GitLab in a secure way.
About this chart
GitLab agent Helm chart
The official Helm chart for the client-side component (agentk) of the GitLab agent for Kubernetes.
For the server-side component (KAS), see the official GitLab Helm chart
Getting started
Prerequisites
This chart requires Helm v3.6 or later.
Install the latest stable release
helm repo add gitlab https://charts.gitlab.io
helm repo update
helm upgrade --install gitlab-agent gitlab/gitlab-agent \
--set config.kasAddress='wss://kas.gitlab.example.com' \
--set config.token='YOUR.AGENT.TOKEN'
Upgrade an existing release
helm repo update
helm get values gitlab-agent > agent-values.yaml
helm upgrade gitlab-agent gitlab/gitlab-agent -f agent-values.yaml
Customize
Values
| Key | Type | Default | Description |
|---|---|---|---|
| image | object | {"pullPolicy":"IfNotPresent","repository":"registry.gitlab.com/gitlab-org/cluster-integration/gitlab-agent/agentk","tag":""} | configure the used image |
| image.repository | string | "registry.gitlab.com/gitlab-org/cluster-integration/gitlab-agent/agentk" | used image repository |
| image.pullPolicy | string | "IfNotPresent" | set the pullPolicy |
| image.tag | string | "" | Overrides the image tag whose default is the chart appVersion. |
| imagePullSecrets | list | [] | Optionally set imagePullSecrets |
| nameOverride | string | "" | Override the default chart name |
| fullnameOverride | string | "" | Override the full chart name |
| replicas | int | 2 | set number of replicas |
| revisionHistoryLimit | int | nil | Cleanup policy, default value is determined by Kubernetes. |
| maxSurge | int | 1 | set maxSurge for rolling update |
| maxUnavailable | int | 0 | set maxUnavailable for rolling update |
| hostUsers | string | nil | Set hostUsers on the pod to enable/disable the host user namespace. Requires Kubernetes 1.36+. Set to false to isolate the pod from the host user namespace. Leave unset to use the Kubernetes default. |
| rbac | object | {"create":true,"useExistingRole":null} | rbac settings |
| rbac.create | bool | true | Specifies whether RBAC resources should be created |
| rbac.useExistingRole | string | cluster-admin | Set to a rolename to use existing role. |
| serviceAccount | object | {"annotations":{},"create":true,"name":null} | serviceAccount settings |
| serviceAccount.create | bool | true | Specifies whether a service account should be created |
| serviceAccount.annotations | object | {} | Annotations to add to the service account |
| serviceAccount.name | string | name is generated using the fullname template | The name of the service account to use. |
| podSecurityContext | object | {} | set podSecurityContext Example: fsGroup: 2000 |
| securityContext | object | {} | set securityContext Example { "capabilities": { "drop": [ "ALL" ] }, "readOnlyRootFilesystem": true, "runAsNonRoot": true, "runAsUser": 1000 } |
| podAnnotations | object | {"prometheus.io/path":"/metrics","prometheus.io/port":"8080","prometheus.io/scrape":"true"} | set podAnnotations |
| serviceMonitor.enabled | bool | false | Specifies whether to create a ServiceMonitor resource for collecting Prometheus metrics |
| config | object | {"api":{"jwtPublicKey":null,"listenAddress":":8082","listenNetwork":"tcp","tls":{"cert":null,"enabled":false,"key":null}},"kasAddress":"grpcs://kas.gitlab.com","kasCaCert":null,"kasHeaders":[],"observability":{"enabled":true,"tls":{"cert":null,"enabled":false,"key":null,"secret":{"create":false,"name":"gitlab-agent-observability"}}},"operational_container_scanning":{"enabled":true,"serviceAccount":{"annotations":{},"create":true,"name":null}},"privateApi":{"listenAddress":":8081","listenNetwork":"tcp","tls":{"caCert":null,"cert":null,"enabled":false,"key":null}},"receptive":{"enabled":false},"secretName":null,"secretProviderClassName":null,"token":null} | configure the agent |
| config.kasAddress | string | "grpcs://kas.gitlab.com" | The user-facing URL for the in-cluster agentk. Use grpcs:// for native gRPC or wss:// for WebSocket. |
| config.kasHeaders | list | [] | add kas-headers Example: [ "Cookie: gitlab-canary" ] |
| config.token | string | nil | put your agent token here |
| config.secretName | string | nil | name of the secret storing the token |
| config.secretProviderClassName | string | nil | Name of the SecretProviderClass that retrieves the token from a CSI Secret Store. Ensure keys are the same as in templates/secret.yaml and values are formatted in the same way. Note that this field is mutually exclusive with config.token, config.secretName, private API TLS, jwtPublicKey, and receptive.enabled. So use either secretProviderClassName and provide all secrets in that way, or use the previously mentioned fields. Additionally, due to the private API JWT being retrieved from the provided config.secretName, use a non-CSI based flow for receptive agents. |
| config.kasCaCert | string | nil | PEM certificate file to use to verify config.kasAddress. Useful if config.kasAddress is self-signed. |
| config.observability.tls | object | {"cert":null,"enabled":false,"key":null,"secret":{"create":false,"name":"gitlab-agent-observability"}} | Application-level TLS configuration for the observability service |
| config.observability.tls.enabled | bool | false | enable application-level TLS for the observability service |
| config.observability.tls.cert | string | nil | Public key for the TLS certificate for the observability service |
| config.observability.tls.key | string | nil | Private key for the TLS certificate for the observability service |
| config.observability.tls.secret.create | bool | false | when true, creates a certificate with values cert and key from for the observability service |
| config.observability.tls.secret.name | string | "gitlab-agent-observability" | secret name for the observability service |
| config.operational_container_scanning.enabled | bool | true | enables automatic RBAC creation for the operational container scanning feature |
| config.operational_container_scanning.serviceAccount | object | {"annotations":{},"create":true,"name":null} | Operational Scanning Service Account configuration |
| config.operational_container_scanning.serviceAccount.create | bool | true | Specifies whether a service account should be created |
| config.operational_container_scanning.serviceAccount.annotations | object | {} | Annotations to add to the service account |
| config.operational_container_scanning.serviceAccount.name | string | name is generated using the fullname template, appended with '-ocs-scanning-pod-sa' | The name of the service account to use. |
| config.receptive.enabled | bool | false | Enable receptive agent |
| config.api.listenNetwork | string | "tcp" | API network to listen on |
| config.api.listenAddress | string | ":8082" | API address to listen on |
| config.api.jwtPublicKey | string | nil | Base64-encoded EdDSA public key to validate JWT tokens from kas. Used for api endpoint |
| config.api.tls | object | {"cert":null,"enabled":false,"key":null} | API TLS configuration |
| config.api.tls.enabled | bool | false | Enable TLS for the api endpoint |
| config.api.tls.cert | string | nil | X.509 certificate in PEM format for api endpoint TLS |
| config.api.tls.key | string | nil | X.509 key in PEM format for api endpoint TLS |
| config.privateApi.listenNetwork | string | "tcp" | Private API network to listen on |
| config.privateApi.listenAddress | string | ":8081" | Private API address to listen on |
| config.privateApi.tls | object | {"caCert":null,"cert":null,"enabled":false,"key":null} | Private API TLS configuration |
| config.privateApi.tls.enabled | bool | false | Enable TLS for the private API endpoint |
| config.privateApi.tls.cert | string | nil | X.509 certificate in PEM format for private API endpoint TLS |
| config.privateApi.tls.key | string | nil | X.509 key in PEM format for private API endpoint TLS |
| config.privateApi.tls.caCert | string | nil | X.509 certificate authority certificate in PEM format for private API endpoint TLS |
| service.type | string | "ClusterIP" | Set the service type |
| service.externalPort | int | 8182 | Set the external port |
| service.internalPort | int | 8082 | Set the internal port |
| service.privateApiPort | int | 8081 | Set the private api port |
| ingress.enabled | bool | false | enabled specifies whether to create an Ingress resource |
| ingress.provider | string | "nginx" | Ingress provider |
| ingress.annotations | object | {} | annotations to add to the Ingress |
| ingress.hostname | string | "agent.example.com" | hostname for the Ingress |
| ingress.tls | object | {"enabled":false} | TLS configuration for the Ingress |
| ingress.tls.enabled | bool | false | enable TLS for the Ingress |
| ingress-nginx.enabled | bool | false | enabled specifies whether to create an Ingress-Nginx resource |
| ingress-nginx.controller | object | {"ingressClassResource":{"name":"gitlab-agent-nginx"}} | Ingress-Nginx controller settings |
| ingress-nginx.controller.ingressClassResource.name | string | "gitlab-agent-nginx" | Ingress class resource name |
| extraEnv | list | [] | Add additional environment settings to the pod. Can be useful in proxy environments |
| extraArgs | list | [] | Add additional args settings to the pod. |
| extraVolumeMounts | list | [] | Add extra volume mounts |
| extraVolumes | list | [] | Add extra volumes |
| resources | object | {} | set resource parameters Example: { "limits": { "cpu": "100m", "memory": "128Mi" }, "requests": { "cpu": "100m", "memory": "128Mi" }} |
| nodeSelector | object | {} | nodeSelector |
| tolerations | list | [] | tolerations |
| affinity | object | {} | set affinity |
| priorityClassName | string | "" | set priorityClassName |
| runtimeClassName | string | "" | set runtimeClassName |
| hostAliases | list | [] | list of hosts and IPs that will be injected into the pod's hosts file Example: [{ "ip": "127.0.0.1", "hostnames": [ "foo.local", "bar.local" ]}, { "ip": "10.1.2.3", "hostnames": [ "foo.remote", "bar.remote" ]}] |
| podLabels | object | {} | Labels to be added to each agent pod Example: role: developer |
| additionalLabels | object | {} | Additional labels to be added to all created objects |
| initContainers | list | [] | Optional initContainers definition |
| extraManifests | list | [] | Add extra Kubernetes manifests to be rendered. Each entry is templated, so you can reference .Release.Name, .Values.*, etc. Because entries are templated, any literal {{ or }} in a value (e.g. in an annotation) must be escaped, e.g. {{ "{{" }}, or rendering will fail. Example: - apiVersion: v1 kind: ConfigMap metadata: name: extra-configmap data: key: value |
| terminationMessagePolicy | string | "FallbackToLogsOnError" | Show the last 80 lines or 2048 bytes (whichever is smaller) of pod logs in kubectl describe output when container exits with non-zero exit code # Useful for when pod logs are cycled out of a node post-crash before an operator can capture the logs Valid values are 'File' which is the Kubernetes API default, or 'FallbackToLogsOnError' See https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/ for more information |
Install from source
git clone https://gitlab.com/gitlab-org/charts/gitlab-agent.git
cd gitlab-agent
helm upgrade --install gitlab-agent . \
--set config.kasAddress='wss://kas.gitlab.example.com' \
--set config.token='YOUR.AGENT.TOKEN'
Development
See CONTRIBUTING.md for our contributor license agreement and code of conduct.
Publishing a new release
- When applicable: Update
appVersioninChart.yamlwith the latest upstream release. - When changing any Helm chart resources (such as anything in
templatesorChart.yaml): UpdateversioninChart.yaml. - For a normal release: Create a tag
vX.Y.ZwhereX.Y.Zis theversionfromChart.yamlunder https://gitlab.com/gitlab-org/charts/gitlab-agent - For a security release: Create a tag
vX.Y.ZwhereX.Y.Zis theversionfromChart.yamlunder https://gitlab.com/gitlab-org/security/charts/gitlab-agent- Note: Security releases should be made in coordination with release managers. The GitLab agent has not had a security release yet, but see the GitLab's security development workflow for the general process.
Third-party trademarks
Kubernetes is a registered trademark of The Linux Foundation.
Deploy gitlab-agent with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has gitlab-agent on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartgitlab-agent is pinned at v2.34.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply