|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * storage/container_storage_csi-google_cloud_file.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="persistent-storage-csi-gcp-filestore-nfs-export-options_{context}"] |
| 7 | += NFS export options |
| 8 | + |
| 9 | +By default, a Filestore instance grants root level read/write access to all clients that share the same Google Cloud project and virtual private cloud (VPC) network. Network File System (NFS) export options can limit this access to certain IP ranges and specific user/group IDs for the Filestore instance. When creating a storage class, you can set these options using the `nfs-export-options-on-create` parameter. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | +* Access to the cluster as a user with the cluster-admin role. |
| 13 | +
|
| 14 | +* The {gcp-short} Filestore CSI Driver Operator and {gcp-short} Filestore CSI driver installed. |
| 15 | +
|
| 16 | +.Procedure |
| 17 | + |
| 18 | +. Create a storage class using a file similar to the following sample YAML file: |
| 19 | ++ |
| 20 | +[NOTE] |
| 21 | +==== |
| 22 | +For more information about creating a storage class, see Section _Creating a storage class for GCP Filestore Operator_. |
| 23 | +==== |
| 24 | ++ |
| 25 | +.Example storage class YAML file with NFS export options |
| 26 | +[source,yaml] |
| 27 | +---- |
| 28 | +kind: StorageClass |
| 29 | +apiVersion: storage.k8s.io/v1 |
| 30 | +metadata: |
| 31 | + name: SC-name |
| 32 | +provisioner: filestore.csi.storage.gke.io |
| 33 | +parameters: |
| 34 | + connect-mode: DIRECT_PEERING |
| 35 | + network: project-network |
| 36 | + nfs-export-options-on-create: '[ <1> |
| 37 | + { |
| 38 | + "accessMode": "READ_WRITE", <2> |
| 39 | + "squashMode": "NO_ROOT_SQUASH", <3> |
| 40 | + "anonUid": 65534 <4> |
| 41 | + "anonGid": 65534 <5> |
| 42 | + "ipRanges": [ <6> |
| 43 | + "10.0.0.0/16" |
| 44 | + ] |
| 45 | + }]' |
| 46 | +allowVolumeExpansion: true |
| 47 | +---- |
| 48 | +<1> *NFS export options parameter* |
| 49 | +<2> *Access mode*: Either `READ_ONLY,` which allows only read requests on the exported directory; or `READ_WRITE`, which allows both read and write requests. The default is `READ_WRITE`. |
| 50 | +<3> *Squash mode*: Either `NO_ROOT_SQUASH`, which allows root access on the exported directory; or ROOT_SQUASH, which does not allow root access. The default is `NO_ROOT_SQUASH`. |
| 51 | +<4> *AnonUid*: An integer representing the anonymous user ID with a default value of 65534. `AnonUid` can only be set with `squashMode` set to `ROOT_SQUASH`; Otherwise, an error occurs. |
| 52 | +<5> *AnonGid*: An integer representing the anonymous group ID with a default value of 65534. `AnonGid` can only be set with `squashMode` set to `ROOT_SQUASH`. Otherwise, an error occurs. |
| 53 | +<6> *IP ranges*: List of either an IPv4 addresses in the format {octet1}.{octet2}.{octet3}.{octet4}, or CIDR ranges in the format {octet1}.{octet2}.{octet3}.{octet4}/{mask size}, which can mount the file share. Overlapping IP ranges are not allowed, both within and across NfsExportOptions, otherwise, an error is returned. The limit is 64 IP ranges or addresses for each `FileShareConfig` among all NFS export options. |
0 commit comments