Skip to content

Commit 2d96ffb

Browse files
Matthew Wongsteveperry-53
authored andcommitted
Add documentation on storageClass.reclaimPolicy (#5171)
1 parent 2090fa2 commit 2d96ffb

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

docs/concepts/storage/persistent-volumes.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ However, the particular path specified in the custom recycler pod template in th
107107

108108
#### Deleting
109109

110-
For volume plugins that support the Delete reclaim policy, deletion removes both the `PersistentVolume` object from Kubernetes, as well as deleting the associated storage asset in the external infrastructure, such as an AWS EBS, GCE PD, Azure Disk, or Cinder volume. Volumes that were dynamically provisioned are always deleted. If that is not desired, currently, the only option is to edit or patch the PV after it is created. See [Change the Reclaim Policy of a PersistentVolume](https://kubernetes.io/docs/tasks/administer-cluster/change-pv-reclaim-policy/).
110+
For volume plugins that support the Delete reclaim policy, deletion removes both the `PersistentVolume` object from Kubernetes, as well as deleting the associated storage asset in the external infrastructure, such as an AWS EBS, GCE PD, Azure Disk, or Cinder volume. Volumes that were dynamically provisioned inherit the [reclaim policy of their `StorageClass`](#reclaim-policy-1), which defaults to Delete. The administrator should configure the `StorageClass` according to users' expectations, otherwise the PV must be edited or patched after it is created. See [Change the Reclaim Policy of a PersistentVolume](https://kubernetes.io/docs/tasks/administer-cluster/change-pv-reclaim-policy/).
111111

112112
## Types of Persistent Volumes
113113

@@ -378,9 +378,9 @@ spec:
378378

379379
## StorageClasses
380380

381-
Each `StorageClass` contains the fields `provisioner` and `parameters`, which
382-
are used when a `PersistentVolume` belonging to the class needs to be
383-
dynamically provisioned.
381+
Each `StorageClass` contains the fields `provisioner`, `parameters`, and
382+
`reclaimPolicy`, which are used when a `PersistentVolume` belonging to the
383+
class needs to be dynamically provisioned.
384384

385385
The name of a `StorageClass` object is significant, and is how users can
386386
request a particular class. Administrators set the name and other parameters
@@ -400,6 +400,7 @@ metadata:
400400
provisioner: kubernetes.io/aws-ebs
401401
parameters:
402402
type: gp2
403+
reclaimPolicy: Retain
403404
mountOptions:
404405
- debug
405406
```
@@ -445,9 +446,10 @@ There are also cases when 3rd party storage vendors provide their own external
445446
provisioner.
446447

447448
### Reclaim Policy
448-
Persistent Volumes that are dynamically created by a storage class will have a reclaim
449-
policy of `delete`. If that is not desired, the only current option is to edit the
450-
PV after it is created.
449+
Persistent Volumes that are dynamically created by a storage class will have the
450+
reclaim policy specified in the `reclaimPolicy` field of the class, which can be
451+
either `Delete` or `Retain`. If no `reclaimPolicy` is specified when a
452+
`StorageClass` object is created, it will default to `Delete`.
451453

452454
Persistent Volumes that are created manually and managed via a storage class will have
453455
whatever reclaim policy they were assigned at creation.

0 commit comments

Comments
 (0)