Skip to content

Commit 62f4bc8

Browse files
Matthew Wongchenopis
Matthew Wong
authored andcommitted
Add documentation on storageClass.mountOptions and PV.mountOptions (#5254)
* Add documentation on storageClass.mountOptions and PV.mountOptions * convert notes into callouts
1 parent 5edcbfd commit 62f4bc8

File tree

1 file changed

+37
-39
lines changed

1 file changed

+37
-39
lines changed

docs/concepts/storage/persistent-volumes.md

+37-39
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,47 +228,14 @@ 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-
```
233+
A Kubernetes administrator can specify additional mount options for when a Persistent Volume is mounted on a node.
264234

265-
A mount option is a string which will be cumulatively joined and used while mounting volume to the disk.
235+
**Note:** Not all Persistent volume types support mount options.
236+
{: .note}
266237

267-
Note that not all Persistent volume types support mount options. In Kubernetes version 1.6, the following
268-
volume types support mount options.
238+
The following volume types support mount options:
269239

270240
* GCEPersistentDisk
271241
* AWSElasticBlockStore
@@ -281,6 +251,22 @@ volume types support mount options.
281251
* Quobyte Volumes
282252
* VMware Photon
283253

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

285271
## PersistentVolumeClaims
286272

@@ -355,8 +341,10 @@ to Kubernetes cluster by addon manager during installation.
355341

356342
When a PVC specifies a `selector` in addition to requesting a `StorageClass`,
357343
the requirements are ANDed together: only a PV of the requested class and with
358-
the requested labels may be bound to the PVC. Note that currently, a PVC with a
359-
non-empty `selector` can't have a PV dynamically provisioned for it.
344+
the requested labels may be bound to the PVC.
345+
346+
**Note:** Currently, a PVC with a non-empty `selector` can't have a PV dynamically provisioned for it.
347+
{: .note}
360348

361349
In the past, the annotation `volume.beta.kubernetes.io/storage-class` was used instead
362350
of `storageClassName` attribute. This annotation is still working, however
@@ -412,6 +400,8 @@ metadata:
412400
provisioner: kubernetes.io/aws-ebs
413401
parameters:
414402
type: gp2
403+
mountOptions:
404+
- debug
415405
```
416406

417407
### Provisioner
@@ -462,6 +452,14 @@ PV after it is created.
462452
Persistent Volumes that are created manually and managed via a storage class will have
463453
whatever reclaim policy they were assigned at creation.
464454

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

0 commit comments

Comments
 (0)