Defining the application and persistent volume claim relationship

You can optionally tie your stateful applications to their persistent volume claims (PVCs) by defining an owner-dependent relationship. By defining this relationship, you enable cascading actions for the applications.

For example, if an owner-dependent relationship is defined, scaling up and scaling down an application can cause the scheduled backups of its PVC to be paused and resumed. Similarly, deleting the application causes the deletion of the PVC, which in turn triggers the deletion of the backups.

After an application starts to use a PVC to store persistent data, you can reconfigure the PVC definition with its owner application.

For guidance, see the following sample configuration file for a PVC, which shows the owner-dependent relationship between an application and a PVC object. The PVC object includes the details of the owner deployment in the ownerReferences field:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: demo-pvc
  ownerReferences:
  - apiVersion: apps/v1beta1
    blockOwnerDeletion: true
    kind: Deployment
    name: Dept10-deployment
    uid: 3b760e89-7da5-11e9-8c5a-0050568ba59c
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: csi-rbd