NFS implements the OKD Recyclable plug-in interface. Automatic
processes handle reclamation tasks based on policies set on each persistent
volume.
By default, PVs are set to Retain. NFS volumes which are set to
Recycle are scrubbed (i.e., rm -rf
is run on the volume) after being
released from their claim (i.e, after the user’s PersistentVolumeClaim
bound
to the volume is deleted). Once recycled, the NFS volume can be bound to a new
claim.
Once claim to a PV is released (that is, the PVC is deleted), the PV object
should not be re-used. Instead, a new PV should be created with the same basic
volume details as the original.
For example, the administrator creates a PV named nfs1
:
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs1
spec:
capacity:
storage: 1Mi
accessModes:
- ReadWriteMany
nfs:
server: 192.168.1.1
path: "/"
The user creates PVC1
, which binds to nfs1
. The user then deletes PVC1
,
releasing claim to nfs1
, which causes nfs1
to be Released
. If the
administrator wishes to make the same NFS share available, they should create a new PV
with the same NFS server details, but a different PV name:
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs2
spec:
capacity:
storage: 1Mi
accessModes:
- ReadWriteMany
nfs:
server: 192.168.1.1
path: "/"
Deleting the original PV and re-creating it with the same name is discouraged.
Attempting to manually change the status of a PV from Released
to Available
causes errors and potential data loss.
|
A PV with retention policy of Recycle scrubs (rm -rf ) the data and marks it
as Available for claim. The Recycle retention policy is deprecated starting
in OKD 3.6 and should be avoided. Anyone using recycler should use
dynamic provision and volume deletion instead.
|