Update local storage docs for beta (#7473)

This commit is contained in:
Michelle Au
2018-02-22 06:29:43 -08:00
committed by k8s-ci-robot
parent 68c57ffafb
commit 279e227bc3
2 changed files with 56 additions and 44 deletions
+6 -4
View File
@@ -638,15 +638,13 @@ references it.
#### Local #### Local
{% assign for_k8s_version="v1.9" %}{% include feature-state-alpha.md %} {% assign for_k8s_version="v1.10" %}{% include feature-state-beta.md %}
This feature requires the `VolumeScheduling` feature gate to be enabled.
```yaml ```yaml
kind: StorageClass kind: StorageClass
apiVersion: storage.k8s.io/v1 apiVersion: storage.k8s.io/v1
metadata: metadata:
name: local-fast name: local-storage
provisioner: kubernetes.io/no-provisioner provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer volumeBindingMode: WaitForFirstConsumer
``` ```
@@ -654,3 +652,7 @@ volumeBindingMode: WaitForFirstConsumer
Local volumes do not support dynamic provisioning yet, however a StorageClass Local volumes do not support dynamic provisioning yet, however a StorageClass
should still be created to delay volume binding until pod scheduling. This is should still be created to delay volume binding until pod scheduling. This is
specified by the `WaitForFirstConsumer` volume binding mode. specified by the `WaitForFirstConsumer` volume binding mode.
Delaying volume binding allows the scheduler to consider all of a pod's
scheduling constraints when choosing an appropriate PersistentVolume for a
PersistentVolumeClaim.
+50 -40
View File
@@ -507,68 +507,78 @@ See the [iSCSI example](https://github.com/kubernetes/examples/tree/{{page.githu
### local ### local
{% assign for_k8s_version="v1.7" %}{% include feature-state-alpha.md %} {% assign for_k8s_version="v1.10" %}{% include feature-state-beta.md %}
This alpha feature requires the `PersistentLocalVolumes` feature gate to be **Note:** The alpha PersistentVolume NodeAffinity annotation has been deprecated
enabled. and will be removed in a future release. Existing PersistentVolumes using this
annotation must be updated by the user to use the new PersistentVolume
**Note:** Starting in 1.9, the `VolumeScheduling` feature gate must also be enabled. `NodeAffinity` field.
{: .note} {: .note}
A `local` volume represents a mounted local storage device such as a disk, A `local` volume represents a mounted local storage device such as a disk,
partition or directory. partition or directory.
Local volumes can only be used as a statically created PersistentVolume. Local volumes can only be used as a statically created PersistentVolume. Dynamic
provisioning is not supported yet.
Compared to `hostPath` volumes, local volumes can be used in a durable manner Compared to `hostPath` volumes, local volumes can be used in a durable and
without manually scheduling pods to nodes, as the system is aware of the volume's portable manner without manually scheduling pods to nodes, as the system is aware
node constraints by looking at the node affinity on the PersistentVolume. of the volume's node constraints by looking at the node affinity on the PersistentVolume.
However, local volumes are still subject to the availability of the underlying However, local volumes are still subject to the availability of the underlying
node and are not suitable for all applications. node and are not suitable for all applications. If a node becomes unhealthy,
then the local volume will also become inaccessible, and a pod using it will not
be able to run. Applications using local volumes must be able to tolerate this
reduced availability, as well as potential data loss, depending on the
durability characteristics of the underlying disk.
The following is an example PersistentVolume spec using a `local` volume: The following is an example PersistentVolume spec using a `local` volume and
`nodeAffinity`:
``` yaml ``` yaml
apiVersion: v1 apiVersion: v1
kind: PersistentVolume kind: PersistentVolume
metadata: metadata:
name: example-pv name: example-pv
annotations:
"volume.alpha.kubernetes.io/node-affinity": '{
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [
{ "matchExpressions": [
{ "key": "kubernetes.io/hostname",
"operator": "In",
"values": ["example-node"]
}
]}
]}
}'
spec: spec:
capacity: capacity:
storage: 100Gi storage: 100Gi
accessModes: accessModes:
- ReadWriteOnce - ReadWriteOnce
persistentVolumeReclaimPolicy: Delete persistentVolumeReclaimPolicy: Delete
storageClassName: local-storage storageClassName: local-storage
local: local:
path: /mnt/disks/ssd1 path: /mnt/disks/ssd1
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- example-node
``` ```
**Note:** The local PersistentVolume cleanup and deletion requires manual intervention without the external provisioner. PersistentVolume `nodeAffinity` is required when using local volumes. It enables
{: .note} the Kubernetes scheduler to correctly schedule pods using local volumes to the
correct node.
Starting in 1.9, local volume binding can be delayed until pod scheduling by When using local volumes, it is recommended to create a StorageClass with
creating a StorageClass with `volumeBindingMode` set to `WaitForFirstConsumer`. `volumeBindingMode` set to `WaitForFirstConsumer`. See the
See the [example](storage-classes.md#local). Delaying volume binding ensures [example](storage-classes.md#local). Delaying volume binding ensures
that the volume binding decision will also be evaluated with any other node that the PersistentVolumeClaim binding decision will also be evaluated with any
constraints the pod may have, such as node resource requirements, node other node constraints the pod may have, such as node resource requirements, node
selectors, pod affinity, and pod anti-affinity. selectors, pod affinity, and pod anti-affinity.
For details on the `local` volume type, see the [Local Persistent Storage An external static provisioner can be run separately for improved management of
user guide](https://github.com/kubernetes-incubator/external-storage/tree/master/local-volume). the local volume lifecycle. Note that this provisioner does not support dynamic
provisioning yet. For an example on how to run an external local provisioner,
see the [local volume provisioner user guide](https://github.com/kubernetes-incubator/external-storage/tree/master/local-volume).
**Note:** The local PersistentVolume requires manual cleanup and deletion by the
user if the external static provisioner is not used to manage the volume
lifecycle.
{: .note}
### nfs ### nfs