// Module included in the following assemblies:
//
// * storage/container_storage_csi-google_cloud_file.adoc

:_mod-docs-content-type: PROCEDURE
[id="persistent-storage-csi-gcp-filestore-nfs-export-options_{context}"]
= NFS export options

[role="_abstract"]
To restrict access to Google Cloud Filestore volumes beyond default project-wide permissions, configure NFS export options that limit access by IP range and user/group IDs.

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.

.Prerequisites
* Access to the cluster as a user with the cluster-admin role.

* The {gcp-short} Filestore CSI Driver Operator and {gcp-short} Filestore CSI driver installed.

.Procedure

. Create a storage class using a file similar to the following sample YAML file:
+
[NOTE]
====
For more information about creating a storage class, see Section _Creating a storage class for GCP Filestore Operator_.
====
+
.Example storage class YAML file with NFS export options
[source,yaml]
----
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
 name: SC-name
provisioner: filestore.csi.storage.gke.io
parameters:
 connect-mode: DIRECT_PEERING
 network: project-network
 nfs-export-options-on-create: '[
   {
     "accessMode": "READ_WRITE",
     "squashMode": "NO_ROOT_SQUASH",
     "anonUid": 65534
     "anonGid": 65534
     "ipRanges": [
       "10.0.0.0/16"
     ]
   }]'
allowVolumeExpansion: true
----
+
For `parameters.nfs-export-options-on-create` arguments:
+
* `AccessMode`: 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`.
* `SquashMode`: 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`.
* `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.
* `AnonGid`: An integer representing the anonymous group ID with a default value of 65534. `AnonGid` can only be set with 
* `ipRanges`: 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.