Skip to content

Commit 82756b1

Browse files
committed
Add a Pod-based example for NFS volumes
1 parent 09707c0 commit 82756b1

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

content/en/docs/concepts/storage/volumes.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,11 +762,33 @@ unmounted. This means that an NFS volume can be pre-populated with data, and
762762
that data can be shared between pods. NFS can be mounted by multiple
763763
writers simultaneously.
764764

765+
```yaml
766+
apiVersion: v1
767+
kind: Pod
768+
metadata:
769+
name: test-pd
770+
spec:
771+
containers:
772+
- image: registry.k8s.io/test-webserver
773+
name: test-container
774+
volumeMounts:
775+
- mountPath: /my-nfs-data
776+
name: test-volume
777+
volumes:
778+
- name: test-volume
779+
nfs:
780+
server: my-nfs-server.example.com
781+
path: /my-nfs-volume
782+
readonly: true
783+
```
784+
765785
{{< note >}}
766786
You must have your own NFS server running with the share exported before you can use it.
787+
788+
Also note that you can't specify NFS mount options in a Pod spec. You can either set mount options server-side or use [/etc/nfsmount.conf](https://man7.org/linux/man-pages/man5/nfsmount.conf.5.html).
767789
{{< /note >}}
768790

769-
See the [NFS example](https://github.com/kubernetes/examples/tree/master/staging/volumes/nfs) for more details.
791+
See the [NFS example](https://github.com/kubernetes/examples/tree/master/staging/volumes/nfs) for an example of mounting NFS volumes with PersistentVolumes.
770792

771793
### persistentVolumeClaim {#persistentvolumeclaim}
772794

0 commit comments

Comments
 (0)