Using the Shared-Secrets Job

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab Self-Managed

The shared-secrets job is responsible for provisioning a variety of secrets used across the installation, unless otherwise manually specified. This includes:

  1. Initial root password
  2. Self-signed TLS certificates for all public services: GitLab, Registry, KAS, and GitLab Pages
  3. Registry authentication certificates
  4. Registry, GitLab Shell, and Gitaly secrets
  5. SSH host keys
  6. GitLab Rails secret for encrypted credentials

Installation command line options

The table below contains all the possible configurations that can be supplied to the helm install command using the --set flag:

ParameterDefaultDescription
enabledtrueSee Below
envproductionRails environment
providerjobSee Below
podLabelsSupplemental Pod labels. Will not be used for selectors.
annotationsSupplemental Pod annotations.
image.pullPolicyAlwaysDEPRECATED: Use global.kubectl.image.pullPolicy instead.
image.pullSecretsDEPRECATED: Use global.kubectl.image.pullSecrets instead.
image.repositoryregistry.gitlab.com/gitlab-org/build/cng/kubectlDEPRECATED: Use global.kubectl.image.repository instead.
image.tag1f8690f03f7aeef27e727396927ab3cc96ac89e7DEPRECATED: Use global.kubectl.image.tag instead.
priorityClassNamePriority class assigned to pods
rbac.createtrueCreate RBAC roles and bindings
resourcesresource requests, limits
securityContext.fsGroup65534User ID to mount filesystems as
securityContext.runAsUser65534User ID to run the container as
selfsign.caSubjectGitLab Helm Chartselfsign CA Subject
selfsign.image.repositoryregistry.gitlab.com/gitlab-org/build/cnf/cfssl-self-signselfsign image repository
selfsign.image.pullSecretsSecrets for the image repository
selfsign.image.tagselfsign image tag
selfsign.keyAlgorithmrsaselfsign cert key algorithm
selfsign.keySize4096selfsign cert key size
serviceAccount.enabledtrueDefine serviceAccountName on job(s)
serviceAccount.createtrueCreate ServiceAccount
serviceAccount.nameRELEASE_NAME-shared-secretsService account name to specify on job(s) (and on the serviceAccount itself if serviceAccount.create=true)
tolerations[]Toleration labels for pod assignment

Job configuration examples

tolerations

tolerations allow you schedule pods on tainted worker nodes

Below is an example use of tolerations:

yaml
tolerations:
- key: "node_label"
  operator: "Equal"
  value: "true"
  effect: "NoSchedule"
- key: "node_label"
  operator: "Equal"
  value: "true"
  effect: "NoExecute"

Select a provisioning backend

provider selects what provisions the secrets. Keep the default value, job. A pre-install and pre-upgrade hook job then generates the secrets.

job is the only supported value. Other values are reserved for internal use, are not supported, and are not intended to be set. Do not change provider unless you know what you are doing.

Setting a secret value such as global.gitaly.authToken.secret changes which Secret the chart uses. The job still generates that Secret, as described in How the job treats existing secrets.

Generated secrets are not owned by the Helm release, so helm uninstall does not remove them. For more information, see uninstall.

How the job treats existing secrets

The job runs on every install and upgrade. It never rotates a value.

  • If a Secret does not exist, the job creates it with every key.
  • If a Secret exists, the job keeps every value in it. It adds a missing key only if the job passes that key to kubectl as a literal. Every token and password is a literal.
  • The job never adds a missing key to a Secret it builds from files. If one of these Secrets exists, the job leaves it unchanged, even if a key is missing:
    • The registry authentication certificate, registry-auth.crt and registry-auth.key.
    • The GitLab Shell SSH host keys.
    • The AI Gateway signing and validation keys.
    • The OpenBao static unseal key.
  • If every Secret and key exists, the job changes no value. It still applies its labels to every Secret, and it writes the Rails secrets.yml back with the same content.

The Rails secret is the exception. The job reads its secrets.yml and keeps every field the chart generates that has a value. It generates each of those fields that is missing, null, or empty. Then it writes the whole document back. The new document holds only the fields the chart generates, under the environment set in env. The job drops every other field, and the blocks of every other environment. It keeps a list as it is, so a rotated active_record_encryption_primary_key survives.

Disable functionality

Some users may wish to explicitly disable the functionality provided by this job. To do this, we have provided the enabled flag as a boolean, defaulting to true.

To disable the job, pass --set shared-secrets.enabled=false, or pass the following in a YAML via the -f flag to helm:

yaml
shared-secrets:
  enabled: false

If you disable this job, you must manually create all secrets, and provide all necessary secret content. See installation/secrets for further details.

enabled: false disables provisioning entirely.

To add a new generated secret to the chart, see Add a generated secret.