The Jenkins kubernetes plugin "dynamic pvc workspace volume" fails to create PersistentVolumeClaim on OpenShift Container Platform

Solution Verified - Updated -

Issue

  • We are using an external Jenkins instance with the kubernetes plugin version 1.19.2 installed.
  • When we try to use the "dynamic pvc workspace volume" feature, it fails to create a PersistentVolumeClaim with the following error:

    Failure executing: POST at: https://example.com/api/v1/namespaces/its-jenkins-prod/persistentvolumeclaims. Message: persistentvolumeclaims "pvc-jenkins-slave-foo-bar-rn7nb" is forbidden: cannot set blockOwnerDeletion if an ownerReference refers to a resource you can't set finalizers on: no RBAC policy matched, <nil>. Received status: Status(apiVersion=v1, code=403, details=StatusDetails(causes=[], group=null, kind=persistentvolumeclaims, name=pvc-jenkins-slave-foo-bar-rn7nb, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=persistentvolumeclaims "pvc-jenkins-slave-foo-bar-rn7nb" is forbidden: cannot set blockOwnerDeletion if an ownerReference refers to a resource you can't set finalizers on: no RBAC policy matched, <nil>, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Forbidden, status=Failure, additionalProperties={}).
    

Environment

  • Red Hat OpenShift Container Platform (OCP)
    • 3
    • 4
  • Jenkins kubernetes plugin
    • 1.19.2 or higher

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content