GitLab: Deployment under Kubernetes
- Git, created by Linus Torvalds, is the engine; GitLab enhances it into a complete platform.
- Installation under Kubernetes with Helm.
- Initial connections and use cases.
- The amount of administrative effort is proportional to usage.
Introduction
On April 8, 2005, Linus Torvalds made the very first commit in Git history.
The famous Finnish developer is not only the creator of Linux; he is also the designer of the source code management tool that has become the most popular in the world: Git.
Git has been so successful that it has ended up eclipsing many of its competitors and has become the most widely used distributed version control system.
Fast and decentralized, Git is an essential tool for CI/CD, even being at the origin of GitOps, a modern approach to system management that you can find presented here through the use of ArgoCD.
However, Git remains an "engine" or a "base" that can function on its own, but it is implemented in many third-party tools to gain more features and capabilities.
You will find many GUI applications that allow you to visualize the history of Git operations as well as the associated branches.
But other applications offer even more features, resulting in complete integration and deployment suites.
This is the case with GitLab.

Click the image to enlarge.
Origin and principles of GitLab
GitLab is a platform that allows you to manage the entire lifecycle of a software project, from source code to production deployment.
At its core, GitLab is primarily a code management tool based on Git, like GitHub or Bitbucket.
It was launched in 2011 by Dmitriy Zaporozhets and Valery Sizov as an open-source project.
GitLab became a company in 2014 with an "Open Core" model.
That is, the core of the product remains open source and is available within a community version, while there is a paid version that offers advanced features.
Over the versions, GitLab has become much more than just a collaborative Git platform; it has evolved into a complete suite dedicated to CI/CD.
However, it is still possible to use GitLab as a simple source code repository.
Each user can decide whether or not to use all of the features offered and choose to remain on the community version or switch to the paid version.Here's what GitLab offers:
| Feature | Description |
|---|---|
| 📁 Git Repository | Code storage with Git, branches, commits, tags, etc |
| 🔍 Code Review | Pull/Merge requests, code discussions, suggestions, approvals |
| ⚙️ Integrated CI/CD | Allows for automated testing, building, and deployment of code |
| 📦 Packages | Storage of dependencies (Docker Registry, Maven, npm…). |
| 🔐 Security | Vulnerability scans, policies, secrets management… |
| 📈 Monitoring & Analytics | Dashboards, performance tracking, cycle time… |
| 📅 Project Management | Issues, epics, kanban boards, milestones. |
| 🔐 Access Management | Users, groups, permissions per project. |
| 🚀 GitOps-ready | Easy integration with Flux or ArgoCD, or GitLab Agent for Kubernetes |
Security options, including auditing features, remain advantages of the enterprise version.
GitLab is also available as a SaaS (Software as a Service), and I encourage you to use this option as soon as possible. A free "Free Tier" plan is even available and can already satisfy small teams (fewer than 5 members).

Click the image to enlarge.
The version as a service (SaaS) is ready to use immediately, which saves you the hassle of managing the platform. Unfortunately, for reasons that still elude me, GitLab struggles to offer hosting in Europe.
As of the writing of this article, Gitlab.com runs on instances hosted by Google Cloud Platform in the us-east1 region.
The problem is that right now, there's a lot of distrust. Depending on your company's activities, it's not always easy to convince the legal and cybersecurity departments to deploy resources outside of European territory.
Apparently, it is possible to have GitLab SaaS instances in Europe, but from what I've learned, this remains a specific approach that requires significant commitment with GitLab.
Therefore, with much regret, and although I myself am a user of GitLab SaaS, I had to resign myself to learning how to deploy it in an on-premise environment...and of course, on Kubernetes😊.
That is the goal of this article: to describe an installation of GitLab on Kubernetes with Helm. What I thought would be basic and quick turned out to be quite an ordeal.
Components in GitLab
The difficulty arises from the fact that GitLab relies on several components. Some can be installed and used independently of GitLab, while others are directly related to the tool.
Here is a table summarizing the situation:
| Component | Main Role | Available in GitLab CE (free) | Requires GitLab EE (paid) |
|---|---|---|---|
| PostgreSQL | Primary database | yes | no |
| Redis | Cache, sessions, queues | yes | no |
| Sidekiq | Background tasks (emails, indexing, etc.) | yes | no |
| GitLab Runner | Execution of CI/CD jobs | yes (possible limitations) | no |
| GitLab Shell | Git access via SSH, Git hooks | yes | no |
| Gitaly | Optimized access to Git repositories | yes | no |
| Praefect | Replication / sharding of Gitaly (HA) | no | yes |
| Workhorse | Advanced web proxy (uploads, Git over HTTP) | yes | no |
| NGINX | Integrated reverse proxy | yes | no |
| Container Registry | Local storage for Docker images | yes | no |
| KAS (GitLab Agent K8s) | Secure communication with Kubernetes (GitOps) | no | yes |
| Advanced CI | (Child pipelines, rules, advanced cache, etc.) Advanced CI/CD | partial | yes |
| SAST / DAST | Secrets: Code security analysis (AppSec) | no | yes |
| Epics / Roadmaps | Product vision and multi-project management | no | yes |
| Compliance | Audit logs: Traceability and regulatory policies | no | yes |
| Observability (Prometheus, Grafana) | Integrated monitoring | yes | no |
| Cluster HA | High availability (base, Gitaly, Redis, etc.) | Manual only | yes |
| MinIO (S3 backend) | S3-compatible object storage (artifacts, uploads, etc.) | yes | no |
Certain modules, such as the PostgreSQL or Redis database, can be deployed independently and then declared in the GitLab configuration to be registered there. Others, like Minio, may be optional, depending on whether or not you use the associated features in GitLab.
In the case of an installation within K8S using Helm, the main disadvantage is that the chart tends to deploy all these components by default (and even others, such as certmanager…).
I will not go into detail about how Helm works, as I have discussed it on many occasions before. I invite you to read this article and also my tutorial on Jenkins, in which I revisit some of the key principles of Helm.
If you are looking for the fastest option, without any specific options during your helm call, you will end up with a plethora of objects and risk conflicts with components already present in your cluster.
I will therefore try to provide an example of a "customized" GitLab installation, while still being based on Helm.
Of course, my use case is not necessarily yours, but it may give you some ideas and help you deploy your own instance in line with your needs.Target and architecture diagram
Here is the target schema for what will be presented in this article.

Click the image to enlarge.
Installation
To start, we will first dedicate a namespace to GitLab, following my usual naming convention, which is: prd-gitlab-lan.
kubectl create ns prd-gitlab-lan

Click the image to enlarge.
Storage management
We will then move on to storage.
It is necessary to create three volumes:
- A persistent volume for the PostgreSQL database: it is necessary to have fast storage.
- A persistent volume for Redis: it is also necessary to have fast storage.
- A persistent volume for Gitaly, which handles the GIT repositories: we can use a network storage type such as NFS.
Storage for PostgreSQL & Redis
Creating these volumes presents an initial challenge. In reality, when using Helm with GitLab, the main chart will call on other charts, such as those for PostgreSQL and Redis. For these latter, it is possible to specify an existing PersistentVolumeClaim (pvc) to force the use of a PersistentVolume(pv) that is already present. For Gitaly, only a StorageClass (sc) is supported.
If you are not comfortable with these concepts, I invite you to review the section dedicated to storage in my K8S cookbook, as well as read this article dedicated to CSI NFS/SMB.
Some people might rightly tell me that we can simply work with StorageClasses and avoid forcing existing PVs. That is true, and in fact, this is how it is recommended to proceed in a corporate environment.
But in my lab, I need to specify my storage targets precisely.
It's not that exotic to want to avoid dynamic provisioning of your PVs within a StorageClass
For this tutorial, I am using my physical Kubernetes node, which serves as both the control plane and a worker. It is the same one that I used for Jenkins and for using a GPU under K8S.
I tend to keep my main multi-node cluster for my "classic" applications and dedicate another cluster (here with a single node...for now) for my tooling. The first cluster often needs components from the second to deploy my resources. In case of problems, it's always useful to have your CI/CD platform separate from the infrastructure dedicated to running applications.
All this to say that I will primarily dedicate local storage on my server to store PostgreSQL and Redis data.
To do this, I declare two directories associated with an NVMe SSD (feel free to read the presentation about the server configuration I use here) sudo mkdir -p /mnt/datastores/prddtsnme001/localpv/prd-gitlab-lan/postgresql
sudo mkdir -p /mnt/datastores/prddtsnme001/localpv/prd-gitlab-lan/redis

Click the image to enlarge.
It is obvious that the data becomes dependent on the node...but, since I only have one server in my cluster (which ultimately isn't a cluster), this isn't a problem.
These two locations can be associated with my storage class sc-local-storage-prddtsnme001. This is a very basic storage class, deployed during my tutorial on using a GPU under K8S.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: sc-local-storage-prddtsnme001
provisioner: kubernetes.io/no-provisioner # Indique qu'il n'y a pas de provisionnement dynamique
volumeBindingMode: WaitForFirstConsumer
I will first declare a PV via the file 01-pv-gitlab-postgresql.yml to point to the directory dedicated to the PostgreSQL database:
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-gitlab-postgresql
labels:
environment: prd
network: lan
application: gitlab
tier: postgresql
spec:
capacity:
storage: 30Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: sc-local-storage-prddtsnme001
local:
path: /mnt/datastores/prddtsnme001/localpv/prd-gitlab-lan/postgresql
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- prdk8sctp001
We can see the storage class sc-local-storage-prddtsnme001 and the location created for this purpose.
As usual, we associate a PVC with this PV through the file 02-pvc-gitlab-postgresql.yml:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-gitlab-postgresql
namespace: prd-gitlab-lan
labels:
environment: prd
network: lan
application: gitlab
tier: postgresql
spec:
accessModes:
- ReadWriteOnce
storageClassName: sc-local-storage-prddtsnme001
resources:
requests:
storage: 30Gi
We proceed in the same way for Redis, first with the PV declared in 03-pv-gitlab-redis.yml:
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-gitlab-redis
labels:
environment: prd
network: lan
application: gitlab
tier: redis
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: sc-local-storage-prddtsnme001
local:
path: /mnt/datastores/prddtsnme001/localpv/prd-gitlab-lan/redis
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- prdk8sctp001
Then the PVC declared in 04-pvc-gitlab-redis.yml:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-gitlab-redis
namespace: prd-gitlab-lan
labels:
environment: prd
network: lan
application: gitlab
tier: redis
spec:
accessModes:
- ReadWriteOnce
storageClassName: sc-local-storage-prddtsnme001
resources:
requests:
storage: 10Gi
By placing these four files in a "storage" folder, you just need to run the command:
kubectl apply -f storage/

Click the image to enlarge.
to have all objects registered on K8S.
You can also verify the PVCs with the command:
kubectl get pvc -n prd-gitlab-lan

Click the image to enlarge.
As it stands, they are not mounted because the storage class used only mounts volumes if they are requested by a pod...and that is not yet the case.
Storage for Gitaly
Then there's the case of Gitaly.
For this volume, we will use NFS, but since the deployment via Helm only supports calling a storage class and requires dynamic provisioning, I must first create this storage class sc-nfs-default. Here is its description, as written in the file 05-sc-nfs-default.yml:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: sc-nfs-default
provisioner: nfs.csi.k8s.io
parameters:
# Le serveur NFS
server: 192.168.10.152
# L'export contenant la racine des dossiers ISO
share: /Volume1/nfsshare/rubikub.coolcorp.priv/storageclass/default
reclaimPolicy: Retain
volumeBindingMode: Immediate
This storage class is based on the NFS CSI, and you can read the presentation and installation instructions in this article.
It utilizes an NFS export from my NAS. In my case, it's a Terramaster, but it doesn't really matter. What's important is that if you also have a NAS of this type (Synology Like), pay attention to the user mapping parameter. It absolutely must be set to No Mapping. Otherwise, you risk encountering problems.

Click the image to enlarge.
Next, we apply the sc:
kubectl apply -f 05-sc-nfs-default.yml

Click the image to enlarge.
Object storage: using Minio
There's still a prerequisite for the storage. This is related to Minio. Indeed, Minio provides object storage via the S3 API. In my case, I have already deployed this solution. You can read the associated article.
GitLab may need Minio to process large artifacts, especially when using Git Lfs (Large File Storage).
Git LFS is an extension of Git that allows you to manage large files in a repository without bloating its history.
My goal is to use my existing Minio instance.
Simply connect to the interface and then start by declaring a bucket. This bucket will be dedicated to GitLab.

Click the image to enlarge.
Next, we create a policy pol-wr-gitlab that will have all rights on this bucket.

Click the image to enlarge.
Then, we create a user named usr-gitlab that inherits this policy.

Click the image to enlarge.
Finally, you just need to create a key associated with this account. This key (name and secret) can then be used by GitLab to access the created bucket. It's important to keep the output obtained.

Click the image to enlarge.
Secrets
Access to Minio
This output will be the first opportunity to create a Kubernetes secret that can be used by GitLab.
We create a secret sec-gitlab-minio, which will contain the ID of the newly obtained Minio key, as well as the connection information for the bucket.
Here's how to do it interactively:
kubectl create secret generic sec-gitlab-minio -n prd-gitlab-lan \
--from-literal=config='{
"provider": "AWS",
"region": "minio",
"endpoint": "https://minioapi.coolcorp.priv",
"path_style": true,
"bucket": "gitlab",
"aws_access_key_id": "id_clef",
"aws_secret_access_key": "secret_clef",
"insecure": true
}'

Click the image to enlarge.
Support for private CA
The second secret to create is the one that will contain the public certificate associated with my CA (certificate authority). As is often the case in many infrastructures, I use an internal CA, specifically Microsoft's, to generate my own certificates.
By default, this CA is not recognized by the GitLab component images; therefore, I need to add it to the list of trusted CAs recognized by GitLab.
I retrieve the public certificate from my CA and save it in a secret:
kubectl create secret generic sec-gitlab-cacert --from-file=ca.crt=ca-coolcorp.crt -n prd-gitlab-lan

Click the image to enlarge.
Connection to AD
Finally, one last secret is needed. This will be used to store the password for the service account used to access my Active Directory, which is used by GitLab to query my directory.
This will allow me to use accounts from my domain to connect to GitLab. However, GitLab needs access to Active Directory (AD) to do this.
Therefore, I create a service account svc-gitlab-readad in my AD.
I store the associated password in a secret sec-gitlab-ldap:
kubectl create secret generic sec-gitlab-ldap --from-literal=password='password' -n prd-gitlab-lan
The ingress configurations
Now, let's switch to the ingress settings.
The ingress configurations will be linked to the K8S Services to allow external access to the cluster through an Ingress Controller.
All of this logic is described in this section of my Kubernetes cookbook, where I present, among other things, the Traefik solution.
Originally, installing GitLab with Helm will automatically configure all necessary ingress by attempting to install an Ingress Controller (NGINX).
The default installation even goes as far as deploying certmanager to automate the acquisition of all associated certificates.
I have already presented certmanager on this site. Feel free to browse the article.
In my case, CertManager and an ingress controller (Traefik) are already present in K8S.
Therefore, I do not want to redeploy these components and prefer to manage the creation of the ingress myself.
We will need three ingress configurations (and three associated certificates).
These three ingress configurations will cover URLs where the DNS record must, of course, point to the Kubernetes server. In the case of use with multiple nodes, as is the case for my K8S cookbook, the IP address must point to a load balancer located in front of the nodes hosting a Traefik instance.
The first ingress configuration will correspond to the URL gitlab.coolcorp.priv and will be linked to the future service gitlab-webservice-default on port 8181. This will allow access to the GitLab GUI from outside.
Here is the file 01-ing-gitlab-default.yaml, which contains the certificate and the ingress configuration.
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: cert-gitlab-default
namespace: prd-gitlab-lan
labels:
environment: prd
network: lan
application: gitlab
tier: default
spec:
commonName: gitlab.coolcorp.priv
secretName: sec-gitlab-cert
privateKey:
algorithm: RSA
size: 4096
dnsNames:
- gitlab.coolcorp.priv
issuerRef:
kind: ClusterIssuer
name: clusterissuer-acme2certifier
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ing-gitlab-default
namespace: prd-gitlab-lan
labels:
environment: prd
network: lan
application: gitlab
tier: default
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
ingressClassName: traefik-lan
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
ingressClassName: traefik-lan
tls:
- hosts:
- gitlab.coolcorp.priv
secretName: sec-gitlab-cert
rules:
- host: gitlab.coolcorp.priv
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: gitlab-webservice-default
port:
number: 8181
The certificate is obtained via the issuer clusterissuer-acme2certifier. All these principles are explained here.
Next, we have the second certificate and the second ingress configuration. This time, for the URL registry.coolcorp.priv, declared in the file 02-ing-gitlab-registry.yaml.
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: cert-gitlab-registry
namespace: prd-gitlab-lan
labels:
environment: prd
network: lan
application: gitlab
tier: registry
spec:
commonName: registry.coolcorp.priv
secretName: sec-gitlab-cert-reg
privateKey:
algorithm: RSA
size: 4096
dnsNames:
- registry.coolcorp.priv
issuerRef:
kind: ClusterIssuer
name: clusterissuer-acme2certifier
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ing-gitlab-registry
namespace: prd-gitlab-lan
labels:
environment: prd
network: lan
application: gitlab
tier: registry
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
ingressClassName: traefik-lan
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
ingressClassName: traefik-lan
tls:
- hosts:
- registry.coolcorp.priv
secretName: sec-gitlab-cert-reg
rules:
- host: registry.coolcorp.priv
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: gitlab-registry
port:
number: 5000
This ingress configuration is linked to the Service of gitlab-registry to allow us to subsequently register container images (we are venturing beyond Git).
Finally, the third ingress (and its associated certificate) covers the URL kas.coolcorp.priv. We use the file 03-ing-gitlab-kas.yaml for this.
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: cert-gitlab-kas
namespace: prd-gitlab-lan
labels:
environment: prd
network: lan
application: gitlab
tier: kas
spec:
commonName: kas.coolcorp.priv
secretName: sec-gitlab-cert-kas
privateKey:
algorithm: RSA
size: 4096
dnsNames:
- kas.coolcorp.priv
issuerRef:
kind: ClusterIssuer
name: clusterissuer-acme2certifier
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ing-gitlab-kas
namespace: prd-gitlab-lan
labels:
environment: prd
network: lan
application: gitlab
tier: kas
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
ingressClassName: traefik-lan
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
ingressClassName: traefik-lan
tls:
- hosts:
- kas.coolcorp.priv
secretName: sec-gitlab-cert-kas
rules:
- host: kas.coolcorp.priv
http:
paths:
- path: "/k8s-proxy/"
pathType: Prefix
backend:
service:
name: gitlab-kas
port:
number: 8154
- path: "/"
pathType: Prefix
backend:
service:
name: gitlab-kas
port:
number: 8150
I am less comfortable with this one. It is supposed to cover "KAS (GitLab Agent K8s)". This is a component that enables bidirectional and secure communication between GitLab and a Kubernetes cluster, via an agent deployed in the cluster. This is similar to GitOps, but I prefer to use ArgoCD for that purpose… also, it seems that KAS is reserved for the paid version of GitLab.
Regardless, I am still declaring the ingress for potential future needs.
I place these three YAML files in an 'ingress' folder and run the command: kubectl apply -f ingress/

Click the image to enlarge.
Consequently, the ingresses have been registered, and the certificates will be ready to use once GitLab and its components are in place.
This is finally the time to proceed with the actual installation of GitLab.
Deployment with Helm
Since we are using Helm, we start by adding the repository:
helm repos add gitlab https://charts.gitlab.io/
helm repos update

Click the image to enlarge.
Before diving in headfirst, and as I have done before with Jenkins, let's first explore the contents of the default values provided by the Gitlab Helm chart.
To do this, I create my usual 'helm' folder and export the default values into a file named default-value.yml. helm show values gitlab/gitlab > helm/default-value.yml

Click the image to enlarge.
The output is extensive, and the value file is very long. It contains all the components with their configurations.

Click the image to enlarge.
It will be necessary to use this result as inspiration to design your own custom-values.yml file.
Here is its content:
global:
certificates:
#on indique le certificat qui contient le certificat de la CA privée
customCAs:
- secret: sec-gitlab-cacert
common:
labels: {}
#On fixe la version à utilisé en partant sur une "Community Edition (ce)"
edition: ce
#a l'heure de rédaction de l'article c'est la version 17.10.3 la plus récente"
gitlabVersion: "17.10.3"
#on fixe les urls
hosts:
domain: coolcorp.priv
https: true
gitlab:
name: gitlab.coolcorp.priv
registry:
name: registry-gitlab.coolcorp.priv
https: false
kas:
name: kas-gitlab.coolcorp.priv
ssh: gitlab.coolcorp.priv
#On désactive l'usage de certmanager
ingress:
configureCertmanager: false
enabled: false
#On désactive le déploiement de minio mais on déclare la configuration associée pour utiliser l'instance minio déja en place
minio:
enabled: false
appConfig:
object_store:
enabled: true
proxy_download: true
connection:
#On utilise le secret créér précédemment pour déclarer la conf minio
secret: sec-gitlab-minio
key: config
storage:
provider: AWS
region: "minio"
endpoint: "https://minioapi.coolcorp.priv"
bucket: "gitlab"
path_style: true
insecure: true # Désactive la vérification SSL
#Configuration de LDAP pour l'accès à l'AD
ldap:
enabled: true
servers:
main:
label: 'Active Directory'
host: 'PRDMUTWIN501.coolcorp.priv' #adresse du contrôleur AD
port: 636 # 636 pour LDAPS, 389 pour LDAP
uid: 'sAMAccountName' # identifiant AD (souvent `sAMAccountName`)
bind_dn: 'CN=svc-gitlab-readad,OU=SVC,OU=USR,DC=coolcorp,DC=priv' # utilisateur de bind
password:
secret: sec-gitlab-ldap
key: password
encryption: 'simple_tls'
verify_certificates: false
smartcard_auth: false
active_directory: true
allow_username_or_email_login: true
lowercase_usernames: false
base: 'DC=coolcorp,DC=priv'
group_base: 'OU=GRP,DC=coolcorp,DC=priv'
admin_group: 'CN=GRP-APP-GITLAB-ADM,OU=PRD,OU=APP,OU=GRP,DC=coolcorp,DC=priv'
external_groups: []
sync_ssh_keys: false
kas:
enabled: true
service:
apiExternalPort: 8153
tls:
enabled: false
verify: true
gitaly:
tls:
enabled: false
#On s'assure que certmanager ne soit pas déployé
certmanager:
installCRDs: false
install: false
#On s'assure que l'ingress controler nginx ne soit pas déployé
nginx-ingress:
enabled: false
prometheus:
install: false
#Configuration de Redis
redis:
master:
persistence:
enabled: true
#on précise bien le PVC existant pour qu'il soit utilisé par redis
existingClaim: pvc-gitlab-redis
install: true
image:
tag: "6.2.16-debian-12-r1"
auth:
existingSecret: gitlab-redis-secret
existingSecretKey: redis-password
usePasswordFiles: true
architecture: standalone
cluster:
enabled: false
metrics:
enabled: true
image:
tag: "1.46.0-debian-11-r8"
#Configuration de postgre
postgresql:
install: true
image:
tag: 14.16.0
primary:
persistence:
#on précise bien le PVC existant pour qu'il soit utilisé par postgre
existingClaim: pvc-gitlab-postgresql
enabled: true
initdb:
scriptsConfigMap: '{{ include "gitlab.psql.initdbscripts" $}}'
extraVolumeMounts:
- name: custom-init-scripts
mountPath: /docker-entrypoint-preinitdb.d/init_revision.sh
subPath: init_revision.sh
podAnnotations:
postgresql.gitlab/init-revision: "1"
metrics:
enabled: false
gitlab-runner:
certsSecretName: sec-gitlab-cacert
install: true
rbac:
create: true
runners:
locked: false
secret: "nonempty"
#On customize la conf du runner pour inclure le CA privée
config: |
[[runners]]
tls-ca-file = "/certs/ca.crt"
[runners.kubernetes]
image = "ubuntu:22.04"
{{- if .Values.global.minio.enabled }}
[runners.cache]
Type = "s3"
Path = "gitlab-runner"
Shared = true
[runners.cache.s3]
ServerAddress = {{ include "gitlab-runner.cache-tpl.s3ServerAddress" . }}
BucketName = "runner-cache"
BucketLocation = "us-east-1"
Insecure = false
{{ end }}
volumeMounts:
- name: runner-ca-cert
mountPath: /certs/ca.crt
subPath: ca.crt
#On réutilise le secret disposant du certificat du CA pour le monter dans le conteneur du runner
volumes:
- name: runner-ca-cert
secret:
secretName: sec-gitlab-cacert
defaultMode: 0444
#Pas d'installation de traefik
traefik:
install: false
gitlab:
toolbox:
replicas: 1
antiAffinityLabels:
matchLabels:
app: gitaly
#Configuration de Gitaly
gitaly:
persistence:
#On utilise la storage class NFS défini précédemment
storageClass: sc-nfs-default
size: 80Gi
securityContext:
fsGroup: 1000
I have tried to comment it as best as possible to indicate the configured elements.
Overall, apart from the ingresses, we are reusing all the objects created previously, from the PVCs and SC to the secrets.
This allows us to specify the elements for persistent data storage and the configuration of LDAPS (Lightweight Directory Access Protocol Secure). Note that we are talking about accessing AD on port 636 for secure communication; it is necessary that AD is configured accordingly.
It is finally time to proceed with the installation of the product:
helm upgrade — -install gitlab gitlab/gitlab --namespace prd-gitlab-lan — -values helm/custom-values.yml

Click the image to enlarge.
The command output shows a series of warnings. For example, the use of the integrated PostgreSQL and Redis databases is primarily intended for testing purposes. GitLab recommends using a separate PostgreSQL instance and a Redis database deployed outside of the GitLab Helm installation.
If you prefer this method, you will need to update the value file to match the connection elements.
In my case, and for my use, this is not very problematic.
Deploying all components will take some time, and it is possible that some pods will fail on the first run while others are still initializing.
You can monitor the deployment with the following command:
kubectl get pod -n prd-gitlab-lan

Click the image to enlarge.
The PVCs should now be mounted:
kubectl get pvc -n prd-gitlab-lan

Click the image to enlarge.
In addition to the PVCs created manually, you can see the additional PVC repo-data-gitlab-gitaly-0 corresponding to gitaly and based on the SC sc-nfs-default.
To be able to connect to GitLab, you can retrieve the default root password, which was created arbitrarily using the following command:
kubectl get secret gitlab-gitlab-initial-root-password -n prd-gitlab-lan -o yaml

Click the image to enlarge.
Be careful, the value is in base64; you need to convert it to get the actual password.
Initial connections and use cases
You can log in at https://gitlab.coolcorp.priv with these credentials.

Click the image to enlarge.
As root, you have full control over the platform.

Click the image to enlarge.
But you can also log in with an AD account since we have configured LDAPS.

Click the image to enlarge.
Since my user is in the correct group, I can indeed connect to GitLab this time by specifying a connection via Active Directory.
Once in my profile, I can create my first repository!

Click the image to enlarge.

Click the image to enlarge.
I can directly add data from the GUI, but my goal remains to be able to do it from my workstation, for example using TortoiseGit.
To do this, I must first declare my SSH public key at the profile level.

Click the image to enlarge.

Click the image to enlarge.
At this point, I should be able to perform a "git clone" on my workstation, where Git is configured with my private key...
Except that's not the case...
Shell (SSH) access issues
There is still one last element: access to the SSH shell of GitLab.
When listing the pods attached to the namespace prd-gitlab-lan, you can see the presence of a pod gitlab-gitlab-shell-***.

Click the image to enlarge.
These are the ones you need to contact if you want to communicate with GitLab via SSH. Normally, port 22 is used for this, but in a containerized environment, it's not that simple.
When you deploy GitLab on a server without using containers, GitLab integrates with the SSH component already present on that server. In fact, it modifies this component to include a redirection for the technical user "git" used to communicate with the repositories. In this case, you retain classic SSH access to the server for its administration while allowing the sending and receiving of data for GitLab…still using port 22.
When GitLab, and more specifically its GitLab Shell component, is containerized, it can no longer directly access the server's SSH on the node where it runs.
We need to find a workaround and another method.
Several options are possible. Ideally, you should have an external reverse proxy solution in front that listens on port 22 and redirects to another port dedicated to GitLab Shell, for example, port 2222.
This is how I plan to proceed, but without using an external reverse proxy.
We will first modify Traefik by adding a new entry point. Typically, we use Traefik for load balancing to Services in K8S over http/https, which is Layer 7.
However, Traefik also supports TCP load balancing at Layer 3.
To do this, we will take the existing Traefik configuration and add a new entry point. The installation of Traefik is described in the section that covers it in my K8S cookbook.
I won't go into detail here, and I invite you to read it to better understand the installation.
In our case, we edit the file traefik-config-lan.yaml to add support for port 2222.
It is also necessary to explicitly add monitoring of the namespace prd-gitlab-lan, because at Layer 3, there is no use for an Ingress Class.

Click the image to enlarge.
We update the Traefik deployment.
helm upgrade traefik-lan traefik/traefik -f traefik-config-lan.yaml -n inf-traefik-lan --set nodeSelector.traefik-lan=yes --set tolerations[0].key=node-role.kubernetes.io/control-plane --set tolerations[0].operator=Exists --set tolerations[0].effect=NoSchedule

Click the image to enlarge.
Note that you must also ensure that the firewall of the underlying operating system running Traefik (here Rocky Linux) allows the port in question.
From now on, Traefik listens on port 2222 and is able to redirect associated traffic to a Kubernetes Service.
To do this, it cannot rely on a classic ingress, but on a custom object specific to Traefik: an IngressRouteTCP (an object that is not associated with an ingress class, hence the need to explicitly add monitoring of the prd-gitlab-lan namespace in the Traefik configuration).
This is described in the file 04-ing-gitlab-ssh.yaml:
---
apiVersion: "traefik.io/v1alpha1"
kind: IngressRouteTCP
metadata:
name: ing-gitlab-ssh
namespace: prd-gitlab-lan
labels:
environment: prd
network: lan
application: gitlab
tier: ssh
spec:
entryPoints:
- ssh
routes:
- match: HostSNI(`*`)
services:
- name: gitlab-gitlab-shell
port: 22
Here, everything that arrives on port 2222 of Traefik will be redirected to the Service K8S gitlab-gitlab-shell on port 22.
We can apply this object using the following command:
kubectl apply -f 04-ing-gitlab-ssh.yaml

Click the image to enlarge.
We can verify this configuration and the presence of the new port directly in the Traefik interface.

Click the image to enlarge.

Click the image to enlarge.
It is now possible to test cloning the demo repository on my workstation.
The first method involves using a standard git clone command. In this case, we can modify the config file for our workstation's SSH configuration. Whether it's Linux or Windows, this file should be placed in the user's personal directory in a subdirectory named .ssh.
By specifying that we want to use port 2222 for the host gitlab.coolcorp.priv, all our git commands will implicitly use this port without us having to specify it.
Host gitlab.coolcorp.priv
Port 2222

Click the image to enlarge.
For example, using the git clone command.

Click the image to enlarge.
If we now want to use more graphical tools like the classic Tortoise Git, we will need to modify the address retrieved from the GitLab interface by adding port 2222.
ssh://[email protected]:2222/vburgun/demo.git

Click the image to enlarge.
At that point, it also becomes possible to communicate with the repository and push data to it, for example.

Click the image to enlarge.

Click the image to enlarge.
Conclusion
GitLab is now deployed under Kubernetes and is fully operational. Using Helm to install this type of platform should be explored before attempting a default configuration.
GitLab is a software that has become massive over time, integrating many internal and external components. Therefore, it is important to understand the role of each element and configure them according to the desired usage.
Also, pay attention to resource consumption. The core of the application is developed in Ruby On Rails and inherits a specific behavior (interpreted language) that must be taken into account when calculating CPU and memory usage on the K8S cluster. Ideally, we should have also addressed this point in the custom values file passed to Helm.
It remains complex to offer a generic installation model for a tool as vast as GitLab. It is even more complex in container form, and it becomes a real challenge in a Kubernetes cluster. Yes, we can quickly deploy elements, but it is also necessary that the installation be permanent over time and interface with the rest of the tools/applications present within an IT environment.
Therefore, if using GitLab's SaaS offering is not possible, be sure to carefully understand what needs to be deployed and how, based on your final requirements.
GitLab is a fantastic platform on which you can build an entire modern and efficient CI/CD pipeline. However, the administrative effort involved is proportional to the level of usage you intend to have.
Always stay consistent with your needs and do not blindly copy the output of an AI prompt that you asked for an installation guide… you risk building a system on shaky foundations.