doc/administration/secrets_manager/linux_package_integration.md
{{< details >}}
{{< /details >}}
{{< history >}}
{{< /history >}}
[!warning] This feature is an experiment and subject to change without notice. This feature is not ready for public testing or production use.
Use a Kubernetes cluster to run OpenBao alongside a GitLab instance installed with the Linux package. OpenBao runs in the cluster and connects to a PostgreSQL database. GitLab Rails and Sidekiq connect to OpenBao over HTTPS.
Run OpenBao in one of two ways:
[!note] The Linux package-managed PostgreSQL cluster is not supported as the OpenBao database backend. If you use such cluster for GitLab, provision a separate PostgreSQL instance for OpenBao, either self-managed or as a managed cloud database service. For more information, see issue 7292.
{{< tabs >}}
{{< tab title="Colocated cluster" >}}
helm and kubectl available on the host.{{< /tab >}}
{{< tab title="External cluster" >}}
helm and kubectl configured to access the cluster.{{< /tab >}}
{{< /tabs >}}
{{< tabs >}}
{{< tab title="Colocated cluster" >}}
Before you install OpenBao, verify your Kubernetes distribution meets these requirements:
LoadBalancer or NodePort, as long as both are reachable within the shared network.{{< /tab >}}
{{< tab title="External cluster" >}}
Before you install OpenBao, verify your setup meets these requirements:
{{< /tab >}}
{{< /tabs >}}
{{< tabs >}}
{{< tab title="Colocated cluster" >}}
Before you begin:
<SHARED_NETWORK_IP>). You need it later for several configuration values.kubectl context is set to this cluster (KUBECONFIG is configured correctly).{{< /tab >}}
{{< tab title="External cluster" >}}
Before you begin:
<POSTGRES_ADDRESS>).
This is either the IP address of your Linux package PostgreSQL node, or the endpoint of your
external or managed PostgreSQL instance.kubectl context is set to this cluster (KUBECONFIG is configured correctly).{{< /tab >}}
{{< /tabs >}}
[!note]
gitlab-psqlis only available when using the Linux package-managed PostgreSQL. If you use an external or managed PostgreSQL instance instead, run equivalent SQL commands on that instance. The user and database creation logic is the same.
gitlab-psql connects over the Unix socket and does not require TCP listeners,
so you can run these commands before gitlab-ctl reconfigure.
To provision the OpenBao PostgreSQL database:
Choose a strong password for the OpenBao database user. You use this same password in the Kubernetes secret in the last step of this section.
Create the OpenBao database user:
sudo gitlab-psql \
-c "CREATE USER openbao WITH PASSWORD '<strong-password>';"
Create the OpenBao database:
sudo gitlab-psql \
-c "CREATE DATABASE openbao OWNER openbao;"
Create the Kubernetes namespace and the secret that passes the database password to the Helm chart:
kubectl create namespace openbao
kubectl create secret generic openbao-db-secret \
--namespace openbao \
--from-literal=password='<strong-password>'
{{< tabs >}}
{{< tab title="Colocated cluster" >}}
To install OpenBao by using Helm:
Add the GitLab Helm repository:
helm repo add gitlab https://charts.gitlab.io
helm repo update
Create an openbao-values.yaml file with the following content, replacing the
placeholder values with your actual domains and IP address:
config:
ui: false
storage:
postgresql:
haEnabled: true
connection:
host: "<SHARED_NETWORK_IP>"
port: 5432
database: openbao
username: openbao
sslMode: "disable"
password:
secret: openbao-db-secret
key: password
initialize:
enabled: true
oidcDiscoveryUrl: "https://<GITLAB_DOMAIN>"
boundIssuer: "https://<GITLAB_DOMAIN>"
boundAudiences: '"https://<OPENBAO_DOMAIN>"'
gatewayRoute:
enabled: false
Install OpenBao:
helm upgrade --install openbao gitlab/openbao \
--namespace openbao \
--values openbao-values.yaml
Do not use --wait, because the pod cannot connect to PostgreSQL.
PostgreSQL only accepts TCP connections from the pod network
after gitlab-ctl reconfigure. For now, pods are in a CrashLoopBackOff
state.
For all available chart options, see the OpenBao Helm chart documentation.
Define the internal URL to use for the OpenBao service. You have multiple options:
oak['components']['openbao']['internal_url'] setting of your gitlab.rb file to the
internal URL of your load balancer to route the requests to the OpenBao Kubernetes service. In this
case, you must configure DNS to make sure the internal URL gets resolved to the internal load balancer IP.nodePort. If you customize your OpenBao chart service to run on a Kubernetes service type
nodePort, the internal URL can also be configured to that.clusterIP. This option is likely the simplest. You can also skip a load balancer completely for your
colocated cluster by informing the OpenBao internal URL to talk directly to the OpenBao service clusterIP.
This option saves you from having to install one more load balancer in your machine because the Linux
package-managed NGINX is already there.You can find the OpenBao service's clusterIP by running:
kubectl -n openbao get svc openbao-active \
-o jsonpath='{.spec.clusterIP}'
Remember that the IP of the internal URL must be accessible by the host machine outside of your Kubernetes cluster.
Configure your cluster to allocate IPs from your chosen <SHARED_NETWORK_IP>.
{{< /tab >}}
{{< tab title="External cluster" >}}
To install OpenBao by using Helm:
Add the GitLab Helm repository:
helm repo add gitlab https://charts.gitlab.io
helm repo update
Create an openbao-values.yaml file with the following content, replacing the
placeholder values with your actual domains and PostgreSQL address:
config:
ui: false
storage:
postgresql:
haEnabled: true
connection:
host: "<POSTGRES_ADDRESS>"
port: 5432
database: openbao
username: openbao
password:
secret: openbao-db-secret
key: password
initialize:
enabled: true
oidcDiscoveryUrl: "https://<GITLAB_DOMAIN>"
boundIssuer: "https://<GITLAB_DOMAIN>"
boundAudiences: '"https://<OPENBAO_DOMAIN>"'
# The chart deploys a Kubernetes Ingress resource by default, which you need to provide the hostname to be reachable for GitLab Rails and Sidekiq
# Alternatively, you could configure it to deploy an HTTPRoute resource, if you prefer to deploy a Gateway API controller.
#
# For available network ingress and TLS configuration options, see:
# https://docs.gitlab.com/charts/charts/openbao/#ingress-and-tls-configuration-options
ingress:
enabled: true
hostname: "<OPENBAO_DOMAIN>"
Install OpenBao:
helm upgrade --install openbao gitlab/openbao \
--namespace openbao \
--values openbao-values.yaml
For all available chart options, see the OpenBao Helm chart documentation.
{{< /tab >}}
{{< /tabs >}}
{{< tabs >}}
{{< tab title="Colocated cluster" >}}
Add the following to /etc/gitlab/gitlab.rb on your GitLab host, replacing the placeholder values
with your actual IP addresses and domain:
# PostgreSQL: accept TCP connections from Kubernetes pods.
# Use the shared network IP to restrict exposure to the shared network.
# Using '0.0.0.0' makes PostgreSQL listen on all interfaces, including public ones.
postgresql['listen_address'] = '<SHARED_NETWORK_IP>'
# Local connections (GitLab Rails and other services) continue without a password.
postgresql['trust_auth_cidr_addresses'] = %w[127.0.0.1/32 ::1/128]
# Kubernetes pods authenticate with a password.
# Replace 10.42.0.0/16 with the CIDR of your Kubernetes CNI (pod network).
postgresql['md5_auth_cidr_addresses'] = %w[10.42.0.0/16]
# OAK: OpenBao reverse proxy via GitLab NGINX.
oak['enable'] = true
oak['network_address'] = '<SHARED_NETWORK_IP>'
oak['components']['openbao']['enable'] = true
# Replace 'https://openbao.example.com' with the URL of the DNS record
# you configured for OpenBao, which resolves to your host's public IP address.
oak['components']['openbao']['external_url'] = 'https://openbao.example.com'
# Example of service clusterIP. Replace <CLUSTER_IP> with the IP taken
# from the previous step.
#
# A nodePort would look similar: specify the cluster node IP with the port
# you chose when you deployed OpenBao.
#
# If behind a load balancer: 'http://openbao-internal.example.com'
oak['components']['openbao']['internal_url'] = 'http://<CLUSTER_IP>:8200'
# The URL that the GitLab application uses to connect to OpenBao.
gitlab_rails['openbao'] = {
'url' => 'https://openbao.example.com'
}
In this configuration:
postgresql['listen_address'] is the shared network IP. Connections from CIDRs not listed
in trust_auth_cidr_addresses or md5_auth_cidr_addresses are rejected by PostgreSQL.postgresql['trust_auth_cidr_addresses'] is a list of CIDR blocks (localhost only). Connections
from these blocks don't require a password. These addresses are used by GitLab services.postgresql['md5_auth_cidr_addresses'] is a list of CIDR blocks from the pod CIDR. Connections
from these blocks require a password. These addresses are used by OpenBao pods.
password authentication. Used by OpenBao pods.oak['network_address'] is the shared network IP. Used by NGINX listen directives.oak['components']['openbao']['internal_url'] is the URL used by the GitLab application
to talk to OpenBao.gitlab_rails['openbao']['url'] is the OpenBao URL used by the GitLab application.If your GitLab external_url setting uses https://, Let's Encrypt is already enabled.
Setting the OpenBao external_url scheme to https:// is sufficient. GitLab
automatically adds the OpenBao domain as a Subject Alternative Name (SAN) on the
existing Let's Encrypt certificate.
To use a custom certificate instead, add:
oak['components']['openbao']['ssl_certificate'] = '/etc/gitlab/ssl/openbao.example.com.crt'
oak['components']['openbao']['ssl_certificate_key'] = '/etc/gitlab/ssl/openbao.example.com.key'
{{< /tab >}}
{{< tab title="External cluster" >}}
Add the following to /etc/gitlab/gitlab.rb on each GitLab application node, replacing the placeholder
values with your actual addresses and domain:
# The URL GitLab Rails uses to connect to OpenBao.
gitlab_rails['openbao'] = {
'url' => 'https://openbao.example.com'
}
If you have separate Sidekiq nodes, add the same gitlab_rails['openbao'] setting to
/etc/gitlab/gitlab.rb on each Sidekiq node. Sidekiq workers that provision secrets also
require access to OpenBao.
If you use the Linux package-managed PostgreSQL as the OpenBao database, also add the following to
/etc/gitlab/gitlab.rb on the PostgreSQL node:
# PostgreSQL: accept TCP connections from Kubernetes pods.
postgresql['listen_address'] = '<POSTGRES_ADDRESS>'
# Local connections (GitLab Rails and other services) continue without a password.
postgresql['trust_auth_cidr_addresses'] = %w[127.0.0.1/32 ::1/128]
# Kubernetes pods authenticate with a password.
# Replace 10.0.0.0/14 with the CIDR of your Kubernetes pod network.
postgresql['md5_auth_cidr_addresses'] = %w[10.0.0.0/14]
{{< /tab >}}
{{< /tabs >}}
{{< tabs >}}
{{< tab title="Colocated cluster" >}}
Apply configuration changes:
sudo gitlab-ctl reconfigure
This command applies all configuration in a single pass:
{{< /tab >}}
{{< tab title="External cluster" >}}
Apply configuration changes on each node where you updated gitlab.rb:
sudo gitlab-ctl reconfigure
On the PostgreSQL node, this makes PostgreSQL accept TCP connections from the cluster pod network. On Rails and Sidekiq nodes, this applies the OpenBao URL configuration.
{{< /tab >}}
{{< /tabs >}}
Wait for the rollout to complete:
kubectl -n openbao rollout status deployment openbao
For colocated clusters, pods previously in a CrashLoopBackOff state become healthy
after gitlab-ctl reconfigure completes.
To verify the installation:
Verify that OpenBao is reachable:
curl "https://openbao.example.com/v1/sys/health"
A successful response looks like:
{
"initialized": true,
"sealed": false,
"standby": false,
"version": "2.0.0"
}