Configuring Redis, PostgreSQL, and Account Credentials
This document describes how to configure the credentials required for GitLab instances.
TOC
Prerequisites
- This document applies to GitLab 17 and above versions provided by the platform. It is decoupled from the platform based on technologies such as Operator.
Redis Credentials
Requirements
GitLab has the following requirements for Redis deployment mode and version:
- Deployment modes support both
StandaloneandSentinelmodes, but RedisClustermode is not supported - Redis version 6.2 or above is required
Credential Format
Create a Secret in the namespace where the GitLab instance is planned to be deployed, select the Opaque type, and add and fill in the following fields in the configuration:
- When both sentinel and standalone configurations are present, the sentinel configuration will take precedence.
- When deploying with high availability templates, if standalone Redis is configured, it is the user's responsibility to ensure the high availability of the Redis instance.
Standalone Example
Sentinel Example
Updating Credentials
If you want to modify Redis connection information after deploying a GitLab instance, you need to directly update the GitLab instance resource, rather than modifying the credential content. For specific operations, please refer to Configuring Redis Access Credentials.
Using Alauda Cache Service for Redis OSS
Redis service can be provided through Alauda Cache Service for Redis OSS, please consider the following important requirements:
- Choose Redis version 7.2 or above
- Select sentinel mode for architecture type
- Choose RDB persistence template for parameter template, such as
system-rdb-redis-7.2-sentinel - Enable data persistence with storage quota not less than 2G
- In multi-network card scenarios, Redis sentinel will select the default IP of the node to initialize the access address of each Redis node, therefore it does not support accessing nodes with non-default IP + exposed port. In this case, it is recommended to use the LoadBalancer access method to create Redis instances. For more details, please refer to the Alauda Cache Service for Redis OSS feature description documentation.
When creating a Redis instance, a Secret containing connection information is automatically generated, which can be used directly to deploy GitLab. This Secret resource can be filtered using the label middleware.instance/type: Redis.
If the Redis instance and GitLab instance are not in the same namespace, you need to copy the Secret resource to the namespace where the GitLab instance is located.
For more Redis deployment parameters and high availability deployment requirements, please refer to the .
Using Alauda Cache Service for Redis OSS
Redis service can be provided by Alauda Cache Service for Redis OSS. In some special scenarios, some restrictions need to be noted.
- In multi-nic scenarios, Redis sentinels will choose the default IP of the node to initialize the access address of each Redis node, so it does not support accessing the node's non-default IP + exposed port. In this case, it is recommended to use LoadBalancer access method to create Redis instances. For more details, please refer to the Alauda Cache Service for Redis OSS feature description document.
PostgreSQL Credentials
Requirements
GitLab has the following requirements for PostgreSQL versions:
- GitLab 17.x requires PostgreSQL version 14.x
- GitLab 18.x requires PostgreSQL version 16.x
Credential Format
Create a Secret in the namespace where the GitLab instance is planned to be deployed, select the Opaque type, and add and fill in the following fields in the configuration:
YAML example:
How to create a database on a PG instance
Connect to the PG instance using the psql cli and execute the following command to create a database
Creating a separate database for gitaly cluster
In high availability mode, the gitaly component needs to be configured in cluster mode and requires a separate database to store gitaly metadata. You need to create another Secret to store the database connection information, with fields consistent with those described above.
sslmode
sslmode is a parameter that controls the security of the connection between the Gitlab service and the PostgreSQL database. Available options:
enable: Enable SSL connectiondisable: Disable SSL connection
When you use Alauda support for PostgreSQL, the sslmode should be set to enable.
When you use external PostgreSQL, the sslmode is depends on your PostgreSQL configuration.
Updating Credentials
If you want to modify PostgreSQL connection information after deploying a GitLab instance, you need to directly update the GitLab instance resource, rather than modifying the credential content. For specific operations, please refer to Configure PostgreSQL Credentials.
Using PostgreSQL Provided by Data Services
Data Services supports deploying PostgreSQL instances that can be used for GitLab deployment. When creating a PostgreSQL instance, please consider the following important requirements:
- Choose a PostgreSQL version that matches your GitLab version, for example, when deploying GitLab 17.x, you need to select PostgreSQL 14.x
- Storage quota should not be less than 5Gi
When creating a PostgreSQL instance, a Secret containing connection information is automatically generated. This Secret resource can be filtered using the label middleware.instance/type: PostgreSQL.
This Secret contains host, port, username, password information. You need to supplement database and sslmode (set to enable) information based on this Secret, and create a new secret in the namespace where the GitLab instance is located.
For more PostgreSQL deployment parameters and requirements, please refer to .
GitLab Account Credentials
Create a Secret in the namespace where the GitLab instance is planned to be deployed, select the Opaque type, and add and fill in the following fields in the configuration: