Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 66 additions & 3 deletions install_config/persistent_storage/selector_label_binding.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.
Expand Down Expand Up @@ -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

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:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chao007 - I dropped "namespace" from the subhead as you suggested, but is it okay to still have it "PVC namespace" here or should it also be removed?

+
.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

Expand Down