Chapter 3. Configuring self-hosted GitLab runner requirements
If you use a self-hosted GitLab instance or self-hosted GitLab runners on OpenShift with Red Hat Advanced Developer Suite - software supply chain, you might encounter failures. The following procedures outline adjustments you might need to make.
- Security Context Constraint (SCC): This is required only if you use your own GitLab runners on OpenShift. This applies whether you are using a self-hosted GitLab instance or gitlab.com.
- Maximum Artifact Size: This is required only if you use a self-hosted GitLab instance
Prerequisites
- You have administrative access to your self-hosted GitLab instance.
- You have cluster-admin access to the OpenShift cluster where your runners will execute jobs.
-
You have installed the OpenShift CLI (
oc).
Procedure
If you use self-hosted runners on OpenShift, set the required security context for the GitLab runners by applying a custom Security Context Constraint (SCC).
Create a YAML file, for example
gitlab-ci-scc.yml, with the following sample content.apiVersion: security.openshift.io/v1 kind: SecurityContextConstraints metadata: name: gitlab-ci-sa-scc namespace: gitlab-runner allowHostPorts: false allowPrivilegeEscalation: true allowPrivilegedContainer: true allowedCapabilities: - SETFCAP - MKNOD defaultAddCapabilities: null fsGroup: type: RunAsAny priority: 5 readOnlyRootFilesystem: false requiredDropCapabilities: - KILL runAsUser: type: MustRunAs uid: 0 seLinuxContext: type: RunAsAny supplementalGroups: type: RunAsAny users: - system:serviceaccount:gitlab-runner:gitlab-ci-sa volumes: - configMap - downwardAPI - emptyDir - persistentVolumeClaim - projected - secretNoteThis manifest is a sample. You might need to adjust settings, such as the namespace in the
usersfield, for your environment.Apply the manifest to your cluster.
$ oc apply -f gitlab-ci-sa-scc.yml
-
If you use a self-hosted GitLab instance, increase the maximum artifact size to prevent pipeline failures. The default 100 MB limit is often insufficient. Increase the limit to at least 1 GB (
1024MB) by following the official GitLab documentation.
Verification
Verify that the Security Context Constraint has been created.
$ oc get scc gitlab-ci-sa-sccThe command should return the name of the SCC.
- After running a pipeline, confirm that it no longer fails due to security context or artifact size errors.
Revised on 2025-11-05 05:28:02 UTC