gitlab-agent

by GitLab

Helm chartv2.34.0App v19.6.0MITVerified publisher

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

KeyTypeDefaultDescription
imageobject{"pullPolicy":"IfNotPresent","repository":"registry.gitlab.com/gitlab-org/cluster-integration/gitlab-agent/agentk","tag":""}configure the used image
image.repositorystring"registry.gitlab.com/gitlab-org/cluster-integration/gitlab-agent/agentk"used image repository
image.pullPolicystring"IfNotPresent"set the pullPolicy
image.tagstring""Overrides the image tag whose default is the chart appVersion.
imagePullSecretslist[]Optionally set imagePullSecrets
nameOverridestring""Override the default chart name
fullnameOverridestring""Override the full chart name
replicasint2set number of replicas
revisionHistoryLimitintnilCleanup policy, default value is determined by Kubernetes.
maxSurgeint1set maxSurge for rolling update
maxUnavailableint0set maxUnavailable for rolling update
hostUsersstringnilSet 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.
rbacobject{"create":true,"useExistingRole":null}rbac settings
rbac.createbooltrueSpecifies whether RBAC resources should be created
rbac.useExistingRolestringcluster-adminSet to a rolename to use existing role.
serviceAccountobject{"annotations":{},"create":true,"name":null}serviceAccount settings
serviceAccount.createbooltrueSpecifies whether a service account should be created
serviceAccount.annotationsobject{}Annotations to add to the service account
serviceAccount.namestringname is generated using the fullname templateThe name of the service account to use.
podSecurityContextobject{}set podSecurityContext Example: fsGroup: 2000
securityContextobject{}set securityContext Example { "capabilities": { "drop": [ "ALL" ] }, "readOnlyRootFilesystem": true, "runAsNonRoot": true, "runAsUser": 1000 }
podAnnotationsobject{"prometheus.io/path":"/metrics","prometheus.io/port":"8080","prometheus.io/scrape":"true"}set podAnnotations
serviceMonitor.enabledboolfalseSpecifies whether to create a ServiceMonitor resource for collecting Prometheus metrics
configobject{"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.kasAddressstring"grpcs://kas.gitlab.com"The user-facing URL for the in-cluster agentk. Use grpcs:// for native gRPC or wss:// for WebSocket.
config.kasHeaderslist[]add kas-headers Example: [ "Cookie: gitlab-canary" ]
config.tokenstringnilput your agent token here
config.secretNamestringnilname of the secret storing the token
config.secretProviderClassNamestringnilName 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.kasCaCertstringnilPEM certificate file to use to verify config.kasAddress. Useful if config.kasAddress is self-signed.
config.observability.tlsobject{"cert":null,"enabled":false,"key":null,"secret":{"create":false,"name":"gitlab-agent-observability"}}Application-level TLS configuration for the observability service
config.observability.tls.enabledboolfalseenable application-level TLS for the observability service
config.observability.tls.certstringnilPublic key for the TLS certificate for the observability service
config.observability.tls.keystringnilPrivate key for the TLS certificate for the observability service
config.observability.tls.secret.createboolfalsewhen true, creates a certificate with values cert and key from for the observability service
config.observability.tls.secret.namestring"gitlab-agent-observability"secret name for the observability service
config.operational_container_scanning.enabledbooltrueenables automatic RBAC creation for the operational container scanning feature
config.operational_container_scanning.serviceAccountobject{"annotations":{},"create":true,"name":null}Operational Scanning Service Account configuration
config.operational_container_scanning.serviceAccount.createbooltrueSpecifies whether a service account should be created
config.operational_container_scanning.serviceAccount.annotationsobject{}Annotations to add to the service account
config.operational_container_scanning.serviceAccount.namestringname is generated using the fullname template, appended with '-ocs-scanning-pod-sa'The name of the service account to use.
config.receptive.enabledboolfalseEnable receptive agent
config.api.listenNetworkstring"tcp"API network to listen on
config.api.listenAddressstring":8082"API address to listen on
config.api.jwtPublicKeystringnilBase64-encoded EdDSA public key to validate JWT tokens from kas. Used for api endpoint
config.api.tlsobject{"cert":null,"enabled":false,"key":null}API TLS configuration
config.api.tls.enabledboolfalseEnable TLS for the api endpoint
config.api.tls.certstringnilX.509 certificate in PEM format for api endpoint TLS
config.api.tls.keystringnilX.509 key in PEM format for api endpoint TLS
config.privateApi.listenNetworkstring"tcp"Private API network to listen on
config.privateApi.listenAddressstring":8081"Private API address to listen on
config.privateApi.tlsobject{"caCert":null,"cert":null,"enabled":false,"key":null}Private API TLS configuration
config.privateApi.tls.enabledboolfalseEnable TLS for the private API endpoint
config.privateApi.tls.certstringnilX.509 certificate in PEM format for private API endpoint TLS
config.privateApi.tls.keystringnilX.509 key in PEM format for private API endpoint TLS
config.privateApi.tls.caCertstringnilX.509 certificate authority certificate in PEM format for private API endpoint TLS
service.typestring"ClusterIP"Set the service type
service.externalPortint8182Set the external port
service.internalPortint8082Set the internal port
service.privateApiPortint8081Set the private api port
ingress.enabledboolfalseenabled specifies whether to create an Ingress resource
ingress.providerstring"nginx"Ingress provider
ingress.annotationsobject{}annotations to add to the Ingress
ingress.hostnamestring"agent.example.com"hostname for the Ingress
ingress.tlsobject{"enabled":false}TLS configuration for the Ingress
ingress.tls.enabledboolfalseenable TLS for the Ingress
ingress-nginx.enabledboolfalseenabled specifies whether to create an Ingress-Nginx resource
ingress-nginx.controllerobject{"ingressClassResource":{"name":"gitlab-agent-nginx"}}Ingress-Nginx controller settings
ingress-nginx.controller.ingressClassResource.namestring"gitlab-agent-nginx"Ingress class resource name
extraEnvlist[]Add additional environment settings to the pod. Can be useful in proxy environments
extraArgslist[]Add additional args settings to the pod.
extraVolumeMountslist[]Add extra volume mounts
extraVolumeslist[]Add extra volumes
resourcesobject{}set resource parameters Example: { "limits": { "cpu": "100m", "memory": "128Mi" }, "requests": { "cpu": "100m", "memory": "128Mi" }}
nodeSelectorobject{}nodeSelector
tolerationslist[]tolerations
affinityobject{}set affinity
priorityClassNamestring""set priorityClassName
runtimeClassNamestring""set runtimeClassName
hostAliaseslist[]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" ]}]
podLabelsobject{}Labels to be added to each agent pod Example: role: developer
additionalLabelsobject{}Additional labels to be added to all created objects
initContainerslist[]Optional initContainers definition
extraManifestslist[]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
terminationMessagePolicystring"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

  1. When applicable: Update appVersion in Chart.yaml with the latest upstream release.
  2. When changing any Helm chart resources (such as anything in templates or Chart.yaml): Update version in Chart.yaml.
  3. For a normal release: Create a tag vX.Y.Z where X.Y.Z is the version from Chart.yaml under https://gitlab.com/gitlab-org/charts/gitlab-agent
  4. For a security release: Create a tag vX.Y.Z where X.Y.Z is the version from Chart.yaml under https://gitlab.com/gitlab-org/security/charts/gitlab-agent

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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartgitlab-agent is pinned at v2.34.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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