GitLab offline delivery repository for Kubernetes.
This repository follows the same delivery contract as apps_redis-cluster: it builds a self-contained .run package containing GitLab manifests, image metadata, and container image tar files. The installer can import images into an internal registry, install GitLab into Kubernetes, keep data persisted by PVCs, expose GitLab through Envoy Gateway API, enable external OIDC login, and optionally configure GitLab external authorization.
This package deploys a single-node GitLab CE Omnibus instance as a Kubernetes StatefulSet.
It creates:
NamespaceConfigMapforGITLAB_OMNIBUS_CONFIGSecretfor initial root password and optional OIDC client secretServicefor HTTP and SSH inside the clusterStatefulSetwith startup, readiness, and liveness probes- three persistent volume claim templates:
/etc/gitlab/var/log/gitlab/var/opt/gitlab
PodDisruptionBudget- optional Gateway API
HTTPRoute - optional Gateway API
TCPRoutefor SSH
This is a stable single-node GitLab deployment, not a full GitLab HA topology. For very large production use, split PostgreSQL, Redis, Gitaly and object storage outside the Omnibus pod or migrate to the official GitLab chart architecture.
Build the offline package:
cd apps_gitlab
bash -n build.sh install.sh
jq empty images/image.json
bash build.sh --arch amd64Install with defaults:
./dist/gitlab-installer-amd64.run install -yInstall using a storage class and a public hostname:
./dist/gitlab-installer-amd64.run install \
--storage-class nfs \
--hostname gitlab.aisphere.local \
--root-password 'GitLab@ChangeMe123' \
-yInstall when images already exist in the internal registry:
./dist/gitlab-installer-amd64.run install \
--registry sealos.hub:5000/kube4 \
--skip-image-prepare \
-yCreate an OIDC application for GitLab and configure its redirect URI as:
https://gitlab.aisphere.local/users/auth/openid_connect/callback
Then install GitLab with OIDC enabled:
./dist/gitlab-installer-amd64.run install \
--hostname gitlab.aisphere.local \
--enable-oidc \
--oidc-issuer https://casdoor.aisphere.local \
--oidc-client-id gitlab \
--oidc-client-secret 'replace-me' \
--oidc-label Casdoor \
--oidc-uid-field sub \
-yThe generated Omnibus config enables GitLab OmniAuth with the openid_connect provider. It uses sub as the default UID field because it is expected to be stable and immutable.
GitLab external authorization is configured after the StatefulSet is ready by running gitlab-rails runner inside the GitLab pod. This is intentional: external authorization is stored in GitLab application settings rather than only in static Kubernetes manifests.
Enable external authorization:
./dist/gitlab-installer-amd64.run install \
--hostname gitlab.aisphere.local \
--enable-external-authz \
--external-authz-url http://iam.aisphere.svc.cluster.local:8080/v1/gitlab/authz \
--external-authz-default-label aisphere \
-yEnable OIDC and external authorization together:
./dist/gitlab-installer-amd64.run install \
--hostname gitlab.aisphere.local \
--enable-oidc \
--oidc-issuer https://casdoor.aisphere.local \
--oidc-client-id gitlab \
--oidc-client-secret 'replace-me' \
--enable-external-authz \
--external-authz-url http://iam.aisphere.svc.cluster.local:8080/v1/gitlab/authz \
--external-authz-default-label aisphere \
-yDisable external authorization explicitly:
./dist/gitlab-installer-amd64.run install \
--disable-external-authz \
-yExternal authorization options:
| Option | Meaning |
|---|---|
--enable-external-authz |
enable GitLab external authorization after rollout |
--disable-external-authz |
disable GitLab external authorization after rollout |
--external-authz-url <url> |
external authorization service URL; required when enabling |
--external-authz-default-label <val> |
default project classification label, default aisphere |
--external-authz-retries <num> |
retry count for gitlab-rails runner, default 30 |
--external-authz-retry-interval <s> |
retry interval in seconds, default 10 |
--external-authz-best-effort |
do not fail install if the running GitLab version does not expose the expected ApplicationSetting fields |
GitLab sends the external service a JSON POST with user and project classification data. Your service should return 200 to allow access and 401 or 403 to deny access. A typical adapter can map user_identifier or OIDC identities to an internal user, then query SpiceDB or another policy engine.
Suggested adapter contract:
GitLab
-> POST /v1/gitlab/authz
user_identifier
project_classification_label
identities[]
-> IAM / SpiceDB adapter
-> 200 allow, 401/403 deny
HTTP exposure is enabled by default through an HTTPRoute:
./dist/gitlab-installer-amd64.run install \
--hostname gitlab.aisphere.local \
--gateway-name aisphere-gateway \
--gateway-namespace aisphere \
--gateway-http-section https \
-yIf Gateway API CRDs are not present, the installer skips route creation by default. To fail fast when the route cannot be created:
./dist/gitlab-installer-amd64.run install --require-gateway -yTo disable Gateway API exposure:
./dist/gitlab-installer-amd64.run install --disable-gateway -ySSH clone/push through Gateway API requires a TCP listener on the Gateway and TCPRoute support:
./dist/gitlab-installer-amd64.run install \
--enable-ssh-route \
--gateway-ssh-section ssh \
--ssh-external-port 22 \
-yIf SSH through Gateway is not enabled, users can still use Git over HTTPS through the HTTPRoute.
| Item | Default |
|---|---|
| namespace | gitlab-system |
| release name | gitlab |
| public hostname | gitlab.aisphere.local |
| external URL | https://gitlab.aisphere.local |
| storage class | nfs |
| config PVC | 5Gi |
| logs PVC | 20Gi |
| data PVC | 100Gi |
| resource profile | mid |
| image pull policy | IfNotPresent |
| wait timeout | 30m |
| target registry repo | sealos.hub:5000/kube4 |
| Gateway HTTPRoute | enabled |
| OIDC | disabled unless --enable-oidc is set |
| external authorization | unchanged unless --enable-external-authz or --disable-external-authz is set |
Default image metadata is in images/image.json:
[
{
"name": "gitlab-ce",
"arch": "amd64",
"platform": "linux/amd64",
"pull": "gitlab/gitlab-ce:18.6.4-ce.0",
"tag": "sealos.hub:5000/kube4/gitlab-ce:18.6.4-ce.0",
"tar": "gitlab-ce-amd64.tar"
}
]| Profile | CPU request | CPU limit | Memory request | Memory limit | Scenario |
|---|---|---|---|---|---|
low |
2 |
4 |
6Gi |
8Gi |
demo or small internal validation |
mid |
4 |
8 |
8Gi |
12Gi |
normal shared internal GitLab |
high |
8 |
16 |
16Gi |
24Gi |
heavier repository and CI metadata usage |
GitLab first boot is slow. The default startup probe allows up to about 15 minutes before declaring startup failure, and the installer waits up to 30m by default.
The installer is intentionally conservative:
- GitLab is a
StatefulSet, not a statelessDeployment. /etc/gitlab,/var/log/gitlab, and/var/opt/gitlabare persisted independently.- PVCs use the configured
StorageClassandReadWriteOnceaccess mode. terminationGracePeriodSecondsis300.preStopcallsgitlab-ctl stopbefore pod termination.- startup, readiness, and liveness probes target
/users/sign_in. PodDisruptionBudgetkeepsminAvailable: 1.- uninstall preserves PVCs unless
--delete-pvcis explicitly provided.
Build side:
build.shreadsimages/image.json.- It pulls the GitLab image for the selected architecture.
- It tags the image into a local payload reference.
- It saves the image to
payload/images/*.tar. - It writes
payload/images/image-index.tsv. - It vendors
manifests/into the payload. - It appends the payload to
install.shto producedist/gitlab-installer-<arch>.run.
Install side:
- the
.runextracts its embedded payload by byte offset - it loads image metadata
- it optionally
docker load, retags and pushes images to the target registry - it renders Kubernetes manifests
- it applies the StatefulSet, Services, PVC templates and Gateway routes
- it waits for StatefulSet rollout
- if requested, it configures external authorization with
gitlab-rails runner
Show help:
./dist/gitlab-installer-amd64.run helpCheck status:
./dist/gitlab-installer-amd64.run status -n gitlab-systemUninstall while preserving PVC data:
./dist/gitlab-installer-amd64.run uninstall -n gitlab-system -yUninstall and delete PVC data:
./dist/gitlab-installer-amd64.run uninstall -n gitlab-system --delete-pvc -yBefore release:
bash -n build.sh install.sh
jq empty images/image.json
bash build.sh --arch amd64
sha256sum -c dist/gitlab-installer-amd64.run.sha256In a cluster with pre-pushed images:
./dist/gitlab-installer-amd64.run install \
--skip-image-prepare \
--storage-class nfs \
--hostname gitlab.aisphere.local \
--enable-oidc \
--oidc-client-id gitlab \
--oidc-client-secret 'replace-me' \
--enable-external-authz \
--external-authz-url http://iam.aisphere.svc.cluster.local:8080/v1/gitlab/authz \
-y