Add local volume documentation (#4050)
* Add local volume documentation * Add PV local volume examplereviewable/pr4170/r1
parent
6b3c84602d
commit
034c7929e2
|
@ -91,6 +91,7 @@ Kubernetes supports several types of Volumes:
|
||||||
* `PortworxVolume`
|
* `PortworxVolume`
|
||||||
* `ScaleIO`
|
* `ScaleIO`
|
||||||
* `StorageOS`
|
* `StorageOS`
|
||||||
|
* `local`
|
||||||
|
|
||||||
We welcome additional contributions.
|
We welcome additional contributions.
|
||||||
|
|
||||||
|
@ -738,6 +739,55 @@ spec:
|
||||||
|
|
||||||
For more information including Dynamic Provisioning and Persistent Volume Claims, please see the [StorageOS examples](https://github.com/kubernetes/kubernetes/tree/{{page.githubbranch}}/examples/volumes/storageos).
|
For more information including Dynamic Provisioning and Persistent Volume Claims, please see the [StorageOS examples](https://github.com/kubernetes/kubernetes/tree/{{page.githubbranch}}/examples/volumes/storageos).
|
||||||
|
|
||||||
|
### local
|
||||||
|
|
||||||
|
This volume type is alpha in 1.7.
|
||||||
|
|
||||||
|
A `local` volume represents a mounted local storage device such as a disk,
|
||||||
|
partition or directory.
|
||||||
|
|
||||||
|
Local volumes can only be used as a statically created PersistentVolume.
|
||||||
|
|
||||||
|
Compared to HostPath volumes, local volumes can be used in a durable manner
|
||||||
|
without manually scheduling pods to nodes, as the system is aware of the volume's
|
||||||
|
node constraints.
|
||||||
|
|
||||||
|
However, local volumes are still subject to the availability of the underlying
|
||||||
|
node and are not suitable for all applications.
|
||||||
|
|
||||||
|
The following is an example PersistentVolume spec using a `local` volume:
|
||||||
|
|
||||||
|
``` yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: example-pv
|
||||||
|
annotations:
|
||||||
|
"volume.alpha.kubernetes.io/node-affinity": '{
|
||||||
|
"requiredDuringSchedulingIgnoredDuringExecution": {
|
||||||
|
"nodeSelectorTerms": [
|
||||||
|
{ "matchExpressions": [
|
||||||
|
{ "key": "kubernetes.io/hostname",
|
||||||
|
"operator": "In",
|
||||||
|
"values": ["example-node"]
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
]}
|
||||||
|
}'
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 100Gi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Delete
|
||||||
|
storageClassName: local-storage
|
||||||
|
local:
|
||||||
|
path: /mnt/disks/ssd1
|
||||||
|
```
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
## Using subPath
|
## Using subPath
|
||||||
|
|
||||||
Sometimes, it is useful to share one volume for multiple uses in a single pod. The `volumeMounts.subPath`
|
Sometimes, it is useful to share one volume for multiple uses in a single pod. The `volumeMounts.subPath`
|
||||||
|
|
Loading…
Reference in New Issue