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