Skip to content

Commit b6ba54a

Browse files
committed
Documentation for volume scheduling alpha feature
1 parent 6154442 commit b6ba54a

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

docs/concepts/storage/persistent-volumes.md

+43-1
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,23 @@ please check [kube-apiserver](/docs/admin/kube-apiserver/) documentation.
6666

6767
### Binding
6868

69-
A user creates, or has already created in the case of dynamic provisioning, a `PersistentVolumeClaim` with a specific amount of storage requested and with certain access modes. A control loop in the master watches for new PVCs, finds a matching PV (if possible), and binds them together. If a PV was dynamically provisioned for a new PVC, the loop will always bind that PV to the PVC. Otherwise, the user will always get at least what they asked for, but the volume may be in excess of what was requested. Once bound, `PersistentVolumeClaim` binds are exclusive, regardless of the mode used to bind them.
69+
A user creates, or has already created in the case of dynamic provisioning, a `PersistentVolumeClaim` with a specific amount of storage requested and with certain access modes. A control loop in the master watches for new PVCs, finds a matching PV (if possible), and binds them together. If a PV was dynamically provisioned for a new PVC, the loop will always bind that PV to the PVC. Otherwise, the user will always get at least what they asked for, but the volume may be in excess of what was requested. Once bound, `PersistentVolumeClaim` binds are exclusive, regardless of how they were bound. A PVC to PV binding is a one-to-one mapping.
7070

7171
Claims will remain unbound indefinitely if a matching volume does not exist. Claims will be bound as matching volumes become available. For example, a cluster provisioned with many 50Gi PVs would not match a PVC requesting 100Gi. The PVC can be bound when a 100Gi PV is added to the cluster.
7272

73+
Alpha support for volume binding during pod scheduling is available in 1.9.
74+
Normally, volume binding occurs immediately upon PVC creation.
75+
However, for PVs that specify NodeAffinity, it may be beneficial to delay
76+
binding until there is a pod consumer that references the PVC. This ensures
77+
that the volume binding decision will also be evaluated with any other node
78+
constraints the pod may have, such as node resource requirements, node
79+
selectors, pod affinity, and pod anti-affinity. This new mode of binding is
80+
controlled through the `VolumeBindingMode` parameter in the
81+
[StorageClass](#StorageClasses).
82+
83+
**Note:** Dynamic provisioning is not supported yet with this alpha feature.
84+
{: .note}
85+
7386
### Using
7487

7588
Pods use claims as volumes. The cluster inspects the claim to find the bound volume and mounts that volume for a pod. For volumes which support multiple access modes, the user specifies which mode desired when using their claim as a volume in a pod.
@@ -437,6 +450,15 @@ request any particular class to bind to: see the
437450
[`PersistentVolumeClaim` section](#persistentvolumeclaims)
438451
for details.
439452

453+
A new alpha field in 1.9, `volumeBindingMode`, controls if volume binding should happen
454+
immediately or wait until pod scheduling. Valid values are `Immediate` and
455+
`WaitForFirstConsumer`. The default mode is `Immediate`.
456+
457+
**Note:** The `WaitForFirstConsumer` volume binding mode does not support
458+
dynamic provisioning yet. Also, it currently is only useful for the
459+
[local](volumes.md#local) volume type. Additional volume types will be
460+
supported in the future.
461+
440462
```yaml
441463
kind: StorageClass
442464
apiVersion: storage.k8s.io/v1
@@ -474,6 +496,7 @@ for provisioning PVs. This field must be specified.
474496
| VsphereVolume | ✓ | [vSphere](#vsphere) |
475497
| PortworxVolume | ✓ | [Portworx Volume](#portworx-volume) |
476498
| ScaleIO | ✓ | [ScaleIO](#scaleio) |
499+
| Local | - | [Local](#local) |
477500

478501
You are not restricted to specifying the "internal" provisioners
479502
listed here (whose names are prefixed with "kubernetes.io" and shipped
@@ -875,6 +898,25 @@ $ kubectl create secret generic storageos-secret --type="kubernetes.io/storageos
875898

876899
Secrets used for dynamically provisioned volumes may be created in any namespace and referenced with the `adminSecretNamespace` parameter. Secrets used by pre-provisioned volumes must be created in the same namespace as the PVC that references it.
877900

901+
#### Local
902+
903+
```yaml
904+
kind: StorageClass
905+
apiVersion: storage.k8s.io/v1
906+
metadata:
907+
name: local-fast
908+
provisioner: kubernetes.io/no-provisioner
909+
volumeBindingMode: WaitForFirstConsumer
910+
parameters:
911+
```
912+
913+
Local volumes do not support dynamic provisioning yet, however a StorageClass
914+
should still be created to delay volume binding until pod scheduling. This is
915+
specified by the `WaitForFirstConsumer` volume binding mode.
916+
917+
**Note:** Local volumes are an alpha feature in 1.7. Volume binding during pod
918+
scheduling is an alpha feature in 1.9.
919+
878920
## Writing Portable Configuration
879921

880922
If you're writing configuration templates or examples that run on a wide range of clusters

docs/concepts/storage/volumes.md

+4
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,10 @@ spec:
814814
**Note:** The local PersistentVolume cleanup and deletion requires manual intervention without the external provisioner.
815815
{: .note}
816816

817+
Starting in 1.9, local volume binding can be delayed by creating a StorageClass
818+
with `volumeBindingMode` set to `WaitForFirstConsumer`. See the
819+
[example](persistent-volumes.md#local).
820+
817821
For details on the `local` volume type, see the [Local Persistent Storage
818822
user guide](https://github.com/kubernetes-incubator/external-storage/tree/master/local-volume).
819823

0 commit comments

Comments
 (0)