@@ -507,68 +507,71 @@ See the [iSCSI example](https://github.com/kubernetes/examples/tree/{{page.githu
507
507
508
508
# ## local
509
509
510
- {% assign for_k8s_version="v1.7" %}{% include feature-state-alpha.md %}
511
-
512
- This alpha feature requires the `PersistentLocalVolumes` feature gate to be
513
- enabled.
514
-
515
- **Note:** Starting in 1.9, the `VolumeScheduling` feature gate must also be enabled.
516
- {: .note}
510
+ {% assign for_k8s_version="v1.10" %}{% include feature-state-beta.md %}
517
511
518
512
A `local` volume represents a mounted local storage device such as a disk,
519
513
partition or directory.
520
514
521
- Local volumes can only be used as a statically created PersistentVolume.
515
+ Local volumes can only be used as a statically created PersistentVolume. Dynamic
516
+ provisioning is not supported yet.
522
517
523
- Compared to `hostPath` volumes, local volumes can be used in a durable manner
524
- without manually scheduling pods to nodes, as the system is aware of the volume's
525
- node constraints by looking at the node affinity on the PersistentVolume.
518
+ Compared to `hostPath` volumes, local volumes can be used in a durable and
519
+ portable manner without manually scheduling pods to nodes, as the system is aware
520
+ of the volume's node constraints by looking at the node affinity on the PersistentVolume.
526
521
527
522
However, local volumes are still subject to the availability of the underlying
528
- node and are not suitable for all applications.
523
+ node and are not suitable for all applications. If a node becomes unhealthy,
524
+ then the local volume will also become inaccessible, and a pod using it will not
525
+ be able to run. Applications using local volumes must be able to tolerate this
526
+ reduced availability, as well as potential data loss, depending on the
527
+ durability characteristics of the underlying disk.
529
528
530
- The following is an example PersistentVolume spec using a `local` volume :
529
+ The following is an example PersistentVolume spec using a `local` volume and
530
+ `nodeAffinity` :
531
531
532
532
` ` ` yaml
533
533
apiVersion: v1
534
534
kind: PersistentVolume
535
535
metadata:
536
536
name: example-pv
537
- annotations:
538
- "volume.alpha.kubernetes.io/node-affinity": '{
539
- "requiredDuringSchedulingIgnoredDuringExecution": {
540
- "nodeSelectorTerms": [
541
- { "matchExpressions": [
542
- { "key": "kubernetes.io/hostname",
543
- "operator": "In",
544
- "values": ["example-node"]
545
- }
546
- ]}
547
- ]}
548
- }'
549
537
spec:
550
- capacity:
551
- storage: 100Gi
552
- accessModes:
553
- - ReadWriteOnce
554
- persistentVolumeReclaimPolicy: Delete
555
- storageClassName: local-storage
556
- local:
557
- path: /mnt/disks/ssd1
538
+ capacity:
539
+ storage: 100Gi
540
+ accessModes:
541
+ - ReadWriteOnce
542
+ persistentVolumeReclaimPolicy: Delete
543
+ storageClassName: local-storage
544
+ local:
545
+ path: /mnt/disks/ssd1
546
+ nodeAffinity:
547
+ required:
548
+ nodeSelectorTerms:
549
+ - matchExpressions:
550
+ - key: kubernetes.io/hostname
551
+ operator: In
552
+ values:
553
+ - example-node
558
554
` ` `
559
555
560
- **Note:** The local PersistentVolume cleanup and deletion requires manual intervention without the external provisioner.
561
- {: .note}
556
+ PersistentVolume `nodeAffinity` is required when using local volumes. It enables
557
+ the Kubernetes scheduler to correctly schedule pods using local volumes to the
558
+ correct node.
562
559
563
- Starting in 1.9, local volume binding can be delayed until pod scheduling by
564
- creating a StorageClass with `volumeBindingMode` set to `WaitForFirstConsumer`.
565
- See the [example](storage-classes.md#local). Delaying volume binding ensures
566
- that the volume binding decision will also be evaluated with any other node
567
- constraints the pod may have, such as node resource requirements, node
560
+ When using local volumes, it is recommended to create a StorageClass with
561
+ ` volumeBindingMode` set to `WaitForFirstConsumer`. See the
562
+ [example](storage-classes.md#local). Delaying volume binding ensures
563
+ that the PersistentVolumeClaim binding decision will also be evaluated with any
564
+ other node constraints the pod may have, such as node resource requirements, node
568
565
selectors, pod affinity, and pod anti-affinity.
569
566
570
- For details on the `local` volume type, see the [Local Persistent Storage
571
- user guide](https://github.com/kubernetes-incubator/external-storage/tree/master/local-volume).
567
+ An external static provisioner can be run separately for improved management of
568
+ the local volume lifecycle. Note that this provisioner does not support dynamic
569
+ provisioning yet. For an example on how to run an external local provisioner,
570
+ see the [local volume provisioner user guide](https://github.com/kubernetes-incubator/external-storage/tree/master/local-volume).
571
+
572
+ **Note:** The local PersistentVolume requires manual cleanup and deletion by the
573
+ user if the external static provisioner is not used to manage the volumes.
574
+ {: .note}
572
575
573
576
# ## nfs
574
577
0 commit comments