Skip to content

Commit 3f0fbc3

Browse files
author
Matthew Wong
committed
Add documentation on storageClass.mountOptions and PV.mountOptions
1 parent 895a607 commit 3f0fbc3

File tree

1 file changed

+31
-37
lines changed

1 file changed

+31
-37
lines changed

docs/concepts/storage/persistent-volumes.md

+31-37
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ Each PV contains a spec and status, which is the specification and status of the
150150
- ReadWriteOnce
151151
persistentVolumeReclaimPolicy: Recycle
152152
storageClassName: slow
153+
mountOptions:
154+
- hard
155+
- nfsvers=4.1
153156
nfs:
154157
path: /tmp
155158
server: 172.17.0.2
@@ -225,46 +228,11 @@ Current reclaim policies are:
225228

226229
Currently, only NFS and HostPath support recycling. AWS EBS, GCE PD, Azure Disk, and Cinder volumes support deletion.
227230

228-
### Phase
229-
230-
A volume will be in one of the following phases:
231-
232-
* Available -- a free resource that is not yet bound to a claim
233-
* Bound -- the volume is bound to a claim
234-
* Released -- the claim has been deleted, but the resource is not yet reclaimed by the cluster
235-
* Failed -- the volume has failed its automatic reclamation
236-
237-
The CLI will show the name of the PVC bound to the PV.
238-
239231
### Mount Options
240232

241-
A Kubernetes administrator can specify additional mount options for when a Persistent Volume is being mounted on a node.
242-
243-
You can specify a mount option by using the annotation `volume.beta.kubernetes.io/mount-options` on
244-
your Persistent Volume.
245-
246-
For example:
247-
248-
```yaml
249-
apiVersion: "v1"
250-
kind: "PersistentVolume"
251-
metadata:
252-
name: gce-disk-1
253-
annotations:
254-
volume.beta.kubernetes.io/mount-options: "discard"
255-
spec:
256-
capacity:
257-
storage: "10Gi"
258-
accessModes:
259-
- "ReadWriteOnce"
260-
gcePersistentDisk:
261-
fsType: "ext4"
262-
pdName: "gce-disk-1"
263-
```
264-
265-
A mount option is a string which will be cumulatively joined and used while mounting volume to the disk.
233+
A Kubernetes administrator can specify additional mount options for when a Persistent Volume is mounted on a node.
266234

267-
Note that not all Persistent volume types support mount options. In Kubernetes version 1.6, the following
235+
Note that not all Persistent volume types support mount options. The following
268236
volume types support mount options.
269237

270238
* GCEPersistentDisk
@@ -281,6 +249,22 @@ volume types support mount options.
281249
* Quobyte Volumes
282250
* VMware Photon
283251

252+
Mount options are not validated, so mount will simply fail if one is invalid.
253+
254+
In the past, the annotation `volume.beta.kubernetes.io/mount-options` was used instead
255+
of the `mountOptions` attribute. This annotation is still working, however
256+
it will become fully deprecated in a future Kubernetes release.
257+
258+
### Phase
259+
260+
A volume will be in one of the following phases:
261+
262+
* Available -- a free resource that is not yet bound to a claim
263+
* Bound -- the volume is bound to a claim
264+
* Released -- the claim has been deleted, but the resource is not yet reclaimed by the cluster
265+
* Failed -- the volume has failed its automatic reclamation
266+
267+
The CLI will show the name of the PVC bound to the PV.
284268

285269
## PersistentVolumeClaims
286270

@@ -412,6 +396,8 @@ metadata:
412396
provisioner: kubernetes.io/aws-ebs
413397
parameters:
414398
type: gp2
399+
mountOptions:
400+
- debug
415401
```
416402

417403
### Provisioner
@@ -462,6 +448,14 @@ PV after it is created.
462448
Persistent Volumes that are created manually and managed via a storage class will have
463449
whatever reclaim policy they were assigned at creation.
464450

451+
### Mount Options
452+
Persistent Volumes that are dynamically created by a storage class will have the
453+
mount options specified in the `mountOptions` field of the class.
454+
455+
If the volume plugin does not support mount options but mount options are
456+
specified, provisioning will fail. Mount options are not validated on neither
457+
the class nor PV, so mount of the PV will simply fail if one is invalid.
458+
465459
### Parameters
466460
Storage classes have parameters that describe volumes belonging to the storage
467461
class. Different parameters may be accepted depending on the `provisioner`. For

0 commit comments

Comments
 (0)