Ce contenu n'est pas disponible dans la langue sélectionnée.

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
      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
  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

    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

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2026 Red Hat
Retour au début