Skip to content

Commit

Permalink
Documentation for volume scheduling alpha feature
Browse files Browse the repository at this point in the history
  • Loading branch information
msau42 committed Nov 29, 2017
1 parent 5de50c9 commit 57ace35
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
19 changes: 18 additions & 1 deletion docs/concepts/storage/persistent-volumes.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,27 @@ please check [kube-apiserver](/docs/admin/kube-apiserver/) documentation.

### Binding

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

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.

#### Binding Modes
{% assign for_k8s_version="v1.9" %}{% include feature-state-alpha.md %}

This requires the `VolumeScheduling` feature gate to be enabled.

Normally, volume binding occurs immediately upon PVC creation.
However, for PVs that specify NodeAffinity, it may be beneficial to delay
binding until there is a pod consumer that references the PVC. This ensures
that the volume binding decision will also be evaluated with any other node
constraints the pod may have, such as node resource requirements, node
selectors, pod affinity, and pod anti-affinity. This new mode of binding is
controlled through the `VolumeBindingMode` parameter in the
[StorageClass](storage-classes.md#thestorageclassresource).

**Note:** Dynamic provisioning is not supported yet with this alpha feature.
{: .note}

### Using

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.
Expand Down
34 changes: 34 additions & 0 deletions docs/concepts/storage/storage-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ mountOptions:
- debug
```
### Volume Binding Mode
{% assign for_k8s_version="v1.9" %}{% include feature-state-alpha.md %}
This field requires the `VolumeScheduling` feature gate to be enabled.

A new field, `volumeBindingMode`, controls if volume binding should happen
immediately or wait until pod scheduling. Valid values are `Immediate` and
`WaitForFirstConsumer`. The default mode is `Immediate`.

**Note:** The `WaitForFirstConsumer` volume binding mode does not support
dynamic provisioning yet. Also, it currently is only useful for the
[local](volumes.md#local) volume type. Additional volume types will be
supported in the future.

### Provisioner

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

You are not restricted to specifying the "internal" provisioners
listed here (whose names are prefixed with "kubernetes.io" and shipped
Expand Down Expand Up @@ -634,3 +649,22 @@ 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.

#### Local

{% assign for_k8s_version="v1.9" %}{% include feature-state-alpha.md %}

This feature requires the `VolumeScheduling` feature gate to be enabled.

```yaml
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: local-fast
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
```

Local volumes do not support dynamic provisioning yet, however a StorageClass
should still be created to delay volume binding until pod scheduling. This is
specified by the `WaitForFirstConsumer` volume binding mode.
11 changes: 10 additions & 1 deletion docs/concepts/storage/volumes.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,12 @@ See the [iSCSI example](https://github.com/kubernetes/examples/tree/{{page.githu

### local

This volume type is alpha in 1.7.
{% assign for_k8s_version="v1.7" %}{% include feature-state-alpha.md %}

This alpha feature requires the `PersistentLocalVolumes` feature gate to be
enabled.

Starting in 1.9, the `VolumeScheduling` feature gate must also be enabled.

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

Starting in 1.9, local volume binding can be delayed by creating a StorageClass
with `volumeBindingMode` set to `WaitForFirstConsumer`. See the
[example](storage-classes.md#local).

For details on the `local` volume type, see the [Local Persistent Storage
user guide](https://github.com/kubernetes-incubator/external-storage/tree/master/local-volume).

Expand Down

0 comments on commit 57ace35

Please sign in to comment.