kubernetes-plugin and PersistentVolumeClaims

17 views
Skip to first unread message

Scott Grissom

unread,
Jan 13, 2020, 4:38:46 PM1/13/20
to Jenkins Users
I have a use case where a PersistentVolumeClaim is used to clone a volume snapshot, which is a prebuilt m2 repository. A PVC object needs to be created before creating the Pod object, then deleted after the pod finishes.

Using kubernetes-plugin, it seems that the yaml attribute in the declarative pipeline only supports Pod objects. Before I go off and try to figure out how to script the creation of a PVC object before launching the Pod, I wanted to ask if there is a mechanism in this plugin that would help manage a PVC lifecycle...and I'm just not seeing it. 

Usov Dmitri

unread,
Jan 13, 2020, 9:48:00 PM1/13/20
to Jenkins Users
https://github.com/jenkinsci/kubernetes-cd-plugin

kubernetes-cd plugin has the capability to create a pvc, the recent plugin version has got fixed an issue with subsequent invocation of a yaml that creates/updates a pvc.

Regards,
Dmitri

scottyg

unread,
Jan 15, 2020, 12:27:08 AM1/15/20
to Jenkins Users
kubernetes-cd is certainly possible, though I haven't figured out how I would use in in a declarative pipeline in conjunction with the kubernetes-plugin yet. But overall it's a less than ideal solution for my use case:
- Cannot use the existing configuration with kubernetes-plugin
- Have to install kubectl on some non-kube node.

I was hoping to find a natural way to integrate creation of PVC before agent launch into kubernetes-plugin but I'm not seeing a clean way to accomplish it.
Reply all
Reply to author
Forward
0 new messages