Configure the GitLab chart with multiple external databases (Alpha)
By default, GitLab uses a single application database, referred to as the main database.
To scale GitLab, you can configure GitLab to use multiple external application databases,
namely main and ci. The following diagram shows how the pods talk to the multiple databases:
Prerequisites:
- All prerequisites listed in the external database document.
- An additional empty
gitlabhq_production_cidatabase, which can be running on the same PostgreSQL server as thegitlabhq_productiondatabase. - Access to the Kubernetes cluster using
the
kubectlandhelmCLI tools. Refer to the GitLab chart prerequisites for more information.
To set up multiple external databases:
-
Create the Kubernetes secret that holds the PostgreSQL secrets for the database user
gitlab. This password can be different, to support having the multiple databases on two different physical servers with different passwords.Let’s choose the name
gitlab-postgresql-passwordfor this Kubernetes secret:kubectl create secret generic gitlab-postgresql-password \ --from-literal=main-gitlab-password=<main-database-password> \ --from-literal=ci-gitlab-password=<ci-database-password> -
Add the following to your existing YAML file that you use to deploy the GitLab chart (for example
gitlab-values.yaml), and replace thehostvalues with yours:global: psql: main: host: main.database.host # set this to the host of your external main database database: gitlabhq_production password: secret: gitlab-postgresql-password key: main-gitlab-password ci: host: ci.database.host # set this to the host of your external ci database. Can be the same as the one for main database database: gitlabhq_production_ci # difference in database containing CI schema, results in `database_tasks: true` as well password: secret: gitlab-postgresql-password key: ci-gitlab-password postgresql: install: falseWhere:
-
postgresql.install: Set tofalseto disable the embedded database, and use the external database instead. -
global.psql.main.host: Set to the hostname of the externalmaindatabase, can be a domain or an IP address. -
global.psql.main.password.secret: The name of the Kubernetes secret, that was used to hold the PostgreSQL user. In our example it’sgitlab-postgresql-password. -
global.psql.main.password.key: Within the secret, the key that contains the password. In our example it’smain-gitlab-password. -
global.psql.ci.host: Set to the hostname of the externalcidatabase, can be a domain or an IP address. It can be the same value asglobal.psql.main.hostif both databasesmainandciare on the same database server. -
global.psql.ci.password.secret: The name of the Kubernetes secret, that was used to hold the PostgreSQL user. In our example it’sgitlab-postgresql-password. -
global.psql.ci.password.key: Within the secret, the key that contains the password. In our example it’sci-gitlab-password.
-
-
Finally, deploy the GitLab chart using
gitlab-values.yaml:helm repo add gitlab https://charts.gitlab.io/ helm repo update helm upgrade --install gitlab gitlab/gitlab --timeout=900s -f gitlab-values.yaml