From f099087ce4b300c3a13cce1aeacd50426a536599 Mon Sep 17 00:00:00 2001 From: Bob Furu Date: Tue, 7 Apr 2020 17:18:31 -0400 Subject: [PATCH 1/2] BZ1739420 - Clarify selector-label volume binding --- .../selector_label_binding.adoc | 69 ++++++++++++++++++- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/install_config/persistent_storage/selector_label_binding.adoc b/install_config/persistent_storage/selector_label_binding.adoc index a2258177f167..7324d0a0f4c6 100644 --- a/install_config/persistent_storage/selector_label_binding.adoc +++ b/install_config/persistent_storage/selector_label_binding.adoc @@ -21,14 +21,14 @@ storage] by identifiers defined by a cluster administrator. [[selector-label-volume-motivation]] == Motivation In cases of statically provisioned storage, developers seeking persistent -storage are required to know a handful identifying attributes of a PV in order +storage are required to know a handful of identifying attributes of a PV in order to deploy and bind a PVC. This creates several problematic situations. Regular users might have to contact a cluster administrator to either deploy the PVC or provide the PV values. PV attributes alone do not convey the intended use of the storage volumes, nor do they provide methods by which volumes can be grouped. Selector and label attributes can be used to abstract away PV details from the -user while providing cluster administrators a way of identifying volumes by a +user while providing cluster administrators with a way of identifying volumes by a descriptive and customizable tag. Through the selector-label method of binding, users are only required to know which labels are defined by the administrator. @@ -53,7 +53,7 @@ xref:./index.adoc#install-config-persistent-storage-index[storage provider] [[selector-label-volume-define]] === Define the Persistent Volume and Claim -. As the *cluser-admin* user, define the PV. For this example, we will +. As the *cluster-admin* user, define the PV. For this example, we will be using a xref:./persistent_storage_glusterfs.adoc#install-config-persistent-storage-persistent-storage-glusterfs[GlusterFS] volume. @@ -111,6 +111,69 @@ spec: labels of targeted PV. ==== +[[selector-label-volume-bind]] +=== Optional: Bind a PVC to a specific PV + +A PVC that does not specify a PV name or selector will match any PV. + +To bind a PVC to a specific PV as a cluster administrator: + +* Use `pvc.spec.volumeName` if you know the PV name. +* Use `pvc.spec.selector` if you know the PV labels. ++ +By specifying a selector, the PVC requires the PV to have specific labels. + + +[[selector-label-volume-reserve]] +=== Optional: Reserve a PV to a specific PVC or namespace + +To reserve a PV for specific tasks, you have two options: create a specific storage class, or pre-bind the PV to your PVC. + +. Request a specific storage class for the PV by specifying the storage class’s name. ++ +The following resource shows the required values that you use to configure a StorageClass. This example uses the AWS ElasticBlockStore (EBS) object definition. + ++ +.StorageClass definition for EBS +==== +---- +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: kafka +provisioner: kubernetes.io/aws-ebs +... +---- +==== ++ +[IMPORTANT] +==== +If necessary in a multi-tenant environment, use a quota definition to reserve the storage class and PV(s) only to a specific namespace. +==== + +. Pre-bind the PV to your PVC using the PVC namespace and name. A PV defined as such will bind only to the specified PVC and to nothing else, as shown in the following example: ++ +.claimRef in PV definition +==== +---- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: mktg-ops--kafka--kafka-broker01 +spec: + capacity: + storage: 15Gi + accessModes: + - ReadWriteOnce + claimRef: + apiVersion: v1 + kind: PersistentVolumeClaim + name: kafka-broker01 + namespace: default +... +---- +==== + [[selector-label-volume-deploy]] === Deploy the Persistent Volume and Claim From 39a8415adff7da857cc09bd364dda93d7649e9d2 Mon Sep 17 00:00:00 2001 From: Bob Furu Date: Sat, 11 Apr 2020 16:34:11 -0400 Subject: [PATCH 2/2] Remove namespace from subhead --- install_config/persistent_storage/selector_label_binding.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_config/persistent_storage/selector_label_binding.adoc b/install_config/persistent_storage/selector_label_binding.adoc index 7324d0a0f4c6..b07b63248ad4 100644 --- a/install_config/persistent_storage/selector_label_binding.adoc +++ b/install_config/persistent_storage/selector_label_binding.adoc @@ -125,7 +125,7 @@ By specifying a selector, the PVC requires the PV to have specific labels. [[selector-label-volume-reserve]] -=== Optional: Reserve a PV to a specific PVC or namespace +=== Optional: Reserve a PV to a specific PVC To reserve a PV for specific tasks, you have two options: create a specific storage class, or pre-bind the PV to your PVC.