Automatically reusing persistent volume including data

1/10/2019

I am currently trying to build a build-pipeline. the pipeline currently is a job with several init containers. One of the init containers is the actual image builder.

To make use of its cache feature, I'd need a mechanism of having the data remain on the storage, so the next iteration can use the cached data.

The only lead for that would be:

However, an administrator can configure a custom recycler pod template using the Kubernetes controller manager command line arguments as described here.

(link for that) https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/

But this link does not really explain anything. And it actually sounds like I'd have to change the recycle policy globally, which is something I'd rather not do.

Leading to the question:

How to tackle this problem gracefully?

-- scones
kubernetes
persistent-volumes

1 Answer

1/10/2019

You can use Dynamic Volume Provisioning running your workload in a StatefulSet to store your cache.

Essentially, when you use it a PVC (Persistent Volume Claim) gets created that is associated with a Physical Volume (The PV also gets created initially) and the PVC is also associated with your pod. So the next time your pod restarts it uses the same Volume. The types of volumes supported will depend on your cloud provider.

-- Rico
Source: StackOverflow