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

  1. 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).

    1. 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
        - secret
      Copy to Clipboard Toggle word wrap
      Note

      This manifest is a sample. You might need to adjust settings, such as the namespace in the users field, for your environment.

    2. Apply the manifest to your cluster.

      $ oc apply -f gitlab-ci-sa-scc.yml
      Copy to Clipboard Toggle word wrap
  2. 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 (1024 MB) by following the official GitLab documentation.

Verification

  • Verify that the Security Context Constraint has been created.

    $ oc get scc gitlab-ci-sa-scc
    Copy to Clipboard Toggle word wrap

    The 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

Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2026 Red Hat
Back to top