Skip to content

Commit 9270841

Browse files
author
pospispa
committed
Persistent Volume Claim Protection
PVC Protection alpha feature was added to K8s 1.9 in PRs: - kubernetes/kubernetes#55824 - kubernetes/kubernetes#55873 and documented in K8s 1.9 in PR: - kubernetes/website#6415 That's why the PVC Protection is a new alpha feature in OpenShift 3.9 and that's why PVC Protection documentation is added.
1 parent 3e5b51f commit 9270841

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

_topic_map.yml

+2
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@ Topics:
395395
File: configuring_vsphere
396396
- Name: Configuring for local Volume
397397
File: configuring_local
398+
- Name: Configuring for Persistent Volume Claim Protection
399+
File: configuring_pvc_protection
398400
- Name: Configuring Persistent Storage
399401
Dir: persistent_storage
400402
Distros: openshift-origin,openshift-enterprise

architecture/additional_concepts/storage.adoc

+35
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,41 @@ 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+
[[pvcprotection]]
110+
111+
=== Persistent Volume Claim Protection
112+
113+
[NOTE]
114+
====
115+
Persistent Volume Claim Protection is an alpha feature and may change in a future release of {product-title}.
116+
====
117+
118+
The purpose of the 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.
119+
120+
[NOTE]
121+
====
122+
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`.
123+
====
124+
125+
When the PVC protection feature is enabled, if a user deletes a PVC in active use by a pod, the PVC is not removed immediately. PVC removal is postponed until the PVC is no longer actively used by any pods.
126+
127+
You can see that a PVC is protected when the PVC's status is `Terminating` and the `Finalizers` list includes `kubernetes.io/pvc-protection`:
128+
[source, shell]
129+
----
130+
kubectl describe pvc hostpath
131+
Name: hostpath
132+
Namespace: default
133+
StorageClass: example-hostpath
134+
Status: Terminating
135+
Volume:
136+
Labels: <none>
137+
Annotations: volume.beta.kubernetes.io/storage-class=example-hostpath
138+
volume.beta.kubernetes.io/storage-provisioner=example.com/hostpath
139+
Finalizers: [kubernetes.io/pvc-protection]
140+
...
141+
----
142+
143+
109144
[[releasing]]
110145

111146
=== Releasing
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[[install-config-configuring-pvc-protection]]
2+
= Configuring for 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
14+
xref:../architecture/additional_concepts/storage.adoc#pvcprotection[Persistent Volume Claim Protection] feature enabled.
15+
16+
[NOTE]
17+
====
18+
Persistent Volume Claim Protection is an alpha feature and may change in a future release of {product-title}.
19+
====
20+
21+
[[local-volume-enabling-local-volumes]]
22+
=== Enable Persistent Volume Claim Protection
23+
Enable the `PVCProtection` feature gate on all masters and nodes.
24+
25+
. Edit or create the master configuration file on all masters (*_/etc/origin/master/master-config.yaml_* by default) and add `PVCProtection=true` under the `apiServerArguments` and `controllerArguments` sections and add `PVCProtection` admission plugin configuration under the `admissionConfig` section:
26+
+
27+
[source, yaml]
28+
----
29+
admissionConfig:
30+
pluginConfig:
31+
PVCProtection:
32+
configuration:
33+
apiVersion: v1
34+
disable: false
35+
kind: DefaultAdmissionConfig
36+
...
37+
kubernetesMasterConfig:
38+
...
39+
apiServerArguments:
40+
feature-gates:
41+
- PVCProtection=true
42+
...
43+
controllerArguments:
44+
feature-gates:
45+
- PVCProtection=true
46+
...
47+
----
48+
49+
. On all nodes, edit or create the node configuration file (*_/etc/origin/node/node-config.yaml_* by default) and add `PVCProtection=true` fetaure gate under `kubeletArguments`.
50+
+
51+
[source, yaml]
52+
----
53+
kubeletArguments:
54+
feature-gates:
55+
- PVCProtection=true
56+
----
57+
58+
. On all masters and nodes, restart OpenShift for the changes to take effect.

0 commit comments

Comments
 (0)