Skip to content

Commit 513488c

Browse files
author
Traci Morrison
authored
Merge pull request #7577 from tmorriso-rh/pospispa-566-postpone-pvc-deletion-if-used-in-a-pod
Trello: Pospispa 566 postpone pvc deletion if used in a pod
2 parents 3e16e95 + 20bddcf commit 513488c

File tree

3 files changed

+113
-15
lines changed

3 files changed

+113
-15
lines changed

_topic_map.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,10 @@ Topics:
395395
Distros: openshift-origin,openshift-enterprise
396396
- Name: Configuring for VMWare vSphere
397397
File: configuring_vsphere
398-
- Name: Configuring for local Volume
398+
- Name: Configuring for Local Volume
399399
File: configuring_local
400+
- Name: Configuring for Persistent Volume Claim Protection
401+
File: configuring_pvc_protection
400402
- Name: Configuring Persistent Storage
401403
Dir: persistent_storage
402404
Distros: openshift-origin,openshift-enterprise

architecture/additional_concepts/storage.adoc

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,42 @@ user for as long as they need it. Users schedule pods and access their claimed
106106
PVs by including a `persistentVolumeClaim` in their pod's volumes block. See
107107
xref:pvc-claims-as-volumes[below] for syntax details.
108108

109-
[[releasing]]
109+
[[pvcprotection]]
110+
=== Persistent Volume Claim Protection
111+
112+
[NOTE]
113+
====
114+
PVC protection is an alpha feature and may change in a future release of {product-title}.
115+
====
116+
117+
The purpose of PVC protection is to ensure that PVCs in active use by a pod are not removed from the system, as this may result in data loss.
118+
119+
[NOTE]
120+
====
121+
A PVC is in active use by a pod when the the pod status is `Pending`, and the pod is assigned to a node or the pod status is `Running`.
122+
====
123+
124+
When the PVC protection feature is enabled, if a user deletes a PVC in active use by a pod, the PVC is not immediately removed. PVC removal is postponed until the PVC is no longer actively used by any pods.
125+
126+
You can see that a PVC is protected when the PVC's status is `Terminating` and the `Finalizers` list includes `kubernetes.io/pvc-protection`:
127+
[source, shell]
128+
----
129+
kubectl describe pvc hostpath
130+
Name: hostpath
131+
Namespace: default
132+
StorageClass: example-hostpath
133+
Status: Terminating
134+
Volume:
135+
Labels: <none>
136+
Annotations: volume.beta.kubernetes.io/storage-class=example-hostpath
137+
volume.beta.kubernetes.io/storage-provisioner=example.com/hostpath
138+
Finalizers: [kubernetes.io/pvc-protection]
139+
...
140+
----
110141

142+
To enable PVC protection, see xref:../../install_config/configuring_pvc_protection.adoc#install-config-configuring-pvc-protection[Configuring Persistent Volume Claim Protection].
143+
144+
[[releasing]]
111145
=== Releasing
112146

113147
When a user is done with a volume, they can delete the PVC object from the API
@@ -138,7 +172,7 @@ If supported by appropriate volume plug-in, recycling performs a basic scrub (`r
138172

139173
[WARNING]
140174
====
141-
The `recycle` reclaim policy is deprecated in favor of dynamic provisioning and it will be removed in future releases.
175+
The `recycle` reclaim policy is deprecated in favor of dynamic provisioning and is removed starting in {product-title} 3.6.
142176
====
143177

144178
ifdef::openshift-origin,openshift-enterprise[]
@@ -255,7 +289,7 @@ Future attributes may include IOPS, throughput, etc.
255289
=== Access Modes
256290

257291
A `PersistentVolume` can be mounted on a host in any way supported by the
258-
resource provider. Providers will have different capabilities and each PV's
292+
resource provider. Providers have different capabilities and each PV's
259293
access modes are set to the specific modes supported by that particular volume.
260294
For example, NFS can support multiple read/write clients, but a specific NFS PV
261295
might be exported on the server as read-only. Each PV gets its own set of access
@@ -317,7 +351,7 @@ Before draining the node, first ensure the pods that use these volumes are
317351
deleted.
318352
====
319353

320-
The table below lists the access modes supported by different persistent volumes:
354+
The table below lists the access modes supported by different PVs:
321355

322356
.Supported Access Modes for Persistent Volumes
323357
[cols=",^v,^v,^v", width="100%",options="header"]
@@ -347,7 +381,7 @@ ifdef::openshift-dedicated,openshift-online[]
347381

348382
=== {product-title} Restrictions
349383

350-
The following restrictions apply when using persistent volumes with {product-title}:
384+
The following restrictions apply when using PVs with {product-title}:
351385
endif::[]
352386

353387
ifdef::openshift-dedicated[]
@@ -370,7 +404,7 @@ ifdef::openshift-online[]
370404
** VOLUME directive without a mapped external volume fails to be instantiated.
371405
* *emptyDir* is restricted to 512 Mi per project (group) per node.
372406
** If there is a single pod for a project on a particular node, then the pod can consume up to 512 Mi of *emptyDir* storage.
373-
** If there are multiple pods for a project on a particular node, then those pods will share the 512 Mi of *emptyDir* storage.
407+
** If there are multiple pods for a project on a particular node, then those pods share the 512 Mi of *emptyDir* storage.
374408
* *emptyDir* has the same lifecycle as the pod:
375409
** *emptyDir* volumes survive container crashes/restarts.
376410
** *emptyDir* volumes are deleted when the pod is deleted.
@@ -404,7 +438,7 @@ Currently, only NFS and HostPath support the 'Recycle' reclaim policy.
404438

405439
[WARNING]
406440
====
407-
The `recycle` reclaim policy is deprecated in favor of dynamic provisioning and it will be removed in future releases.
441+
The `recycle` reclaim policy is deprecated in favor of dynamic provisioning and is removed starting in {product-title} 3.6.
408442
====
409443

410444
[[pv-phase]]
@@ -440,7 +474,7 @@ ifdef::openshift-enterprise,openshift-origin[]
440474
=== Mount Options
441475
[IMPORTANT]
442476
====
443-
Mount Options is a Technology Preview feature and it is only available for manually provisioned persistent volumes.
477+
Mount Options is a Technology Preview feature and it is only available for manually provisioned PVs.
444478
ifdef::openshift-enterprise[]
445479
Technology Preview features are not supported with Red Hat production service
446480
level agreements (SLAs), might not be functionally complete, and Red Hat does
@@ -453,7 +487,7 @@ https://access.redhat.com/support/offerings/techpreview/.
453487
endif::[]
454488
====
455489

456-
You can specify mount options while mounting a persistent volume by using the annotation `volume.beta.kubernetes.io/mount-options`.
490+
You can specify mount options while mounting a PV by using the annotation `volume.beta.kubernetes.io/mount-options`.
457491

458492
For example:
459493

@@ -478,9 +512,9 @@ spec:
478512
name: claim1
479513
namespace: default
480514
----
481-
<1> Specified mount options are then used while mounting the persistent volume to the disk.
515+
<1> Specified mount options are then used while mounting the PV to the disk.
482516

483-
The following persistent volume types support mount options:
517+
The following PV types support mount options:
484518

485519
- NFS
486520
- GlusterFS
@@ -495,7 +529,7 @@ The following persistent volume types support mount options:
495529

496530
[NOTE]
497531
====
498-
Fibre Channel and HostPath persistent volumes do not support mount options.
532+
Fibre Channel and HostPath PVs do not support mount options.
499533
====
500534
endif::openshift-enterprise,openshift-origin[]
501535
[[persistent-volume-claims]]
@@ -584,7 +618,7 @@ ifdef::openshift-enterprise,openshift-origin[]
584618
== Block Volume Support
585619
[IMPORTANT]
586620
====
587-
Block Volume Support is a Technology Preview feature and it is only available for manually provisioned persistent volumes.
621+
Block Volume Support is a Technology Preview feature and it is only available for manually provisioned PVs.
588622
ifdef::openshift-enterprise[]
589623
Technology Preview features are not supported with Red Hat production service
590624
level agreements (SLAs), might not be functionally complete, and Red Hat does
@@ -635,7 +669,7 @@ spec:
635669
requests:
636670
storage: 10Gi
637671
----
638-
<1> `volumeMode` field indicating that a raw block persistent volume is requested.
672+
<1> `volumeMode` field indicating that a raw block PV is requested.
639673

640674
.Example Pod Specification
641675
[source, yaml]
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
[[install-config-configuring-pvc-protection]]
2+
= Configuring Persistent Volume Claim Protection
3+
{product-version}
4+
:data-uri:
5+
:icons:
6+
:experimental:
7+
:toc: macro
8+
:toc-title:
9+
10+
toc::[]
11+
12+
== Overview
13+
{product-title} can be configured to have the
14+
xref:../architecture/additional_concepts/storage.adoc#pvcprotection[persistent
15+
volume claim (PVC) protection] feature enabled. This feature ensures that PVCs
16+
in active use by a pod are not removed from the system, as this may result in
17+
data loss.
18+
19+
[NOTE]
20+
====
21+
PVC protection is an alpha feature and may change in a future release of {product-title}.
22+
====
23+
24+
[[local-volume-enabling-local-volumes]]
25+
=== Enable PVC Protection
26+
27+
To enable the `PVCProtection` feature gate on all masters and nodes:
28+
29+
. Edit or create the master configuration file on all masters (*_/etc/origin/master/master-config.yaml_* by default). Add `PVCProtection=true` under the `apiServerArguments` and `controllerArguments` sections, and add `PVCProtection` admission plugin configuration under the `admissionConfig` section:
30+
+
31+
[source, yaml]
32+
----
33+
admissionConfig:
34+
pluginConfig:
35+
PVCProtection:
36+
configuration:
37+
apiVersion: v1
38+
disable: false
39+
kind: DefaultAdmissionConfig
40+
...
41+
kubernetesMasterConfig:
42+
...
43+
apiServerArguments:
44+
feature-gates:
45+
- PVCProtection=true
46+
...
47+
controllerArguments:
48+
feature-gates:
49+
- PVCProtection=true
50+
...
51+
----
52+
53+
. On all nodes, edit or create the node configuration file (*_/etc/origin/node/node-config.yaml_* by default), and add the `PVCProtection=true` feature gate under `kubeletArguments`:
54+
+
55+
[source, yaml]
56+
----
57+
kubeletArguments:
58+
feature-gates:
59+
- PVCProtection=true
60+
----
61+
62+
. On all masters and nodes, restart {product-title} for the changes to take effect.

0 commit comments

Comments
 (0)