Skip to content

Commit 0c63121

Browse files
committed
Documentation for volume scheduling alpha feature
1 parent 5de50c9 commit 0c63121

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed

docs/concepts/storage/persistent-volumes.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,27 @@ please check [kube-apiserver](/docs/admin/kube-apiserver/) documentation.
6060

6161
### Binding
6262

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

6565
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.
6666

67+
#### Binding Modes
68+
{% assign for_k8s_version="v1.9" %}{% include feature-state-alpha.md %}
69+
70+
This requires the `VolumeScheduling` feature gate to be enabled.
71+
72+
Normally, volume binding occurs immediately upon PVC creation.
73+
However, for PVs that specify NodeAffinity, it may be beneficial to delay
74+
binding until there is a pod consumer that references the PVC. This ensures
75+
that the volume binding decision will also be evaluated with any other node
76+
constraints the pod may have, such as node resource requirements, node
77+
selectors, pod affinity, and pod anti-affinity. This new mode of binding is
78+
controlled through the `VolumeBindingMode` parameter in the
79+
[StorageClass](storage-classes.md#thestorageclassresource).
80+
81+
**Note:** Dynamic provisioning is not supported yet with this alpha feature.
82+
{: .note}
83+
6784
### Using
6885

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

docs/concepts/storage/storage-classes.md

+35
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,21 @@ mountOptions:
5252
- debug
5353
```
5454
55+
### Volume Binding Mode
56+
{% assign for_k8s_version="v1.9" %}{% include feature-state-alpha.md %}
57+
58+
This field requires the `VolumeScheduling` feature gate to be enabled.
59+
60+
A new field, `volumeBindingMode`, controls if volume binding should happen
61+
immediately or wait until pod scheduling. Valid values are `Immediate` and
62+
`WaitForFirstConsumer`. The default mode is `Immediate`, which is the same
63+
behavior prior to this feature.
64+
65+
**Note:** The `WaitForFirstConsumer` volume binding mode does not support
66+
dynamic provisioning yet. Also, it currently is only useful for the
67+
[local](volumes.md#local) volume type. Additional volume types will be
68+
supported in the future.
69+
5570
### Provisioner
5671

5772
Storage classes have a provisioner that determines what volume plugin is used
@@ -78,6 +93,7 @@ for provisioning PVs. This field must be specified.
7893
| PortworxVolume | ✓ | [Portworx Volume](#portworx-volume) |
7994
| ScaleIO | ✓ | [ScaleIO](#scaleio) |
8095
| StorageOS | ✓ | [StorageOS](#storageos) |
96+
| Local | - | [Local](#local) |
8197

8298
You are not restricted to specifying the "internal" provisioners
8399
listed here (whose names are prefixed with "kubernetes.io" and shipped
@@ -634,3 +650,22 @@ Secrets used for dynamically provisioned volumes may be created in any namespace
634650
and referenced with the `adminSecretNamespace` parameter. Secrets used by
635651
pre-provisioned volumes must be created in the same namespace as the PVC that
636652
references it.
653+
654+
#### Local
655+
656+
{% assign for_k8s_version="v1.9" %}{% include feature-state-alpha.md %}
657+
658+
This feature requires the `VolumeScheduling` feature gate to be enabled.
659+
660+
```yaml
661+
kind: StorageClass
662+
apiVersion: storage.k8s.io/v1
663+
metadata:
664+
name: local-fast
665+
provisioner: kubernetes.io/no-provisioner
666+
volumeBindingMode: WaitForFirstConsumer
667+
```
668+
669+
Local volumes do not support dynamic provisioning yet, however a StorageClass
670+
should still be created to delay volume binding until pod scheduling. This is
671+
specified by the `WaitForFirstConsumer` volume binding mode.

docs/concepts/storage/volumes.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,12 @@ See the [iSCSI example](https://github.com/kubernetes/examples/tree/{{page.githu
434434

435435
### local
436436

437-
This volume type is alpha in 1.7.
437+
{% assign for_k8s_version="v1.7" %}{% include feature-state-alpha.md %}
438+
439+
This alpha feature requires the `PersistentLocalVolumes` feature gate to be
440+
enabled.
441+
442+
Starting in 1.9, the `VolumeScheduling` feature gate must also be enabled.
438443

439444
A `local` volume represents a mounted local storage device such as a disk,
440445
partition or directory.
@@ -481,6 +486,10 @@ spec:
481486
**Note:** The local PersistentVolume cleanup and deletion requires manual intervention without the external provisioner.
482487
{: .note}
483488

489+
Starting in 1.9, local volume binding can be delayed until pod scheduling by
490+
creating a StorageClass with `volumeBindingMode` set to `WaitForFirstConsumer`.
491+
See the [example](storage-classes.md#local).
492+
484493
For details on the `local` volume type, see the [Local Persistent Storage
485494
user guide](https://github.com/kubernetes-incubator/external-storage/tree/master/local-volume).
486495

0 commit comments

Comments
 (0)