The default configuration of OpenShift Pipelines 1.3.x and later versions does not allow you to run pods with privileged security context, if the pods result from pipeline run or task run. For such pods, the default service account is pipeline, and the security context constraint (SCC) associated with the pipelines service account is pipelines-scc. The pipelines-scc SCC is similar to the anyuid SCC, but with a minor difference as defined in the YAML file for the SCC of pipelines:

Example SecurityContextConstraints object
apiVersion: security.openshift.io/v1
kind: SecurityContextConstraints
  type: MustRunAs

In addition, the Buildah cluster task, shipped as part of the OpenShift Pipelines, uses vfs as the default storage driver.

Running pipeline run and task run pods with privileged security context


To run a pod (resulting from pipeline run or task run) with the privileged security context, do the following modifications:

  • Configure the associated user account or service account to have an explicit SCC. You can perform the configuration using any of the following methods:

    • Run the following command:

      $ oc adm policy add-scc-to-user <scc-name> -z <service-account-name>
    • Alternatively, modify the YAML files for RoleBinding, and Role or ClusterRole:

      Example RoleBinding object
      apiVersion: rbac.authorization.k8s.io/v1
      kind: RoleBinding
        name: service-account-name (1)
        namespace: default
        apiGroup: rbac.authorization.k8s.io
        kind: ClusterRole
        name: pipelines-scc-clusterrole (2)
      - kind: ServiceAccount
        name: pipeline
        namespace: default
      1 Substitute with an appropriate service account name.
      2 Substitute with an appropriate cluster role based on the role binding you use.
      Example ClusterRole object
      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
        name: pipelines-scc-clusterrole (1)
      - apiGroups:
        - security.openshift.io
        - nonroot
        - securitycontextconstraints
        - use
      1 Substitute with an appropriate cluster role based on the role binding you use.

    As a best practice, create a copy of the default YAML files and make changes in the duplicate file.

  • If you do not use the vfs storage driver, configure the service account associated with the task run or the pipeline run to have a privileged SCC, and set the security context as privileged: true.

Additional resources