> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/containers/managed-kubernetes/how-tos/mount-an-nfs-volume.md).

# Mount an NFS Volume

Mount an NFS volume in IONOS CLOUD Managed Kubernetes: connect Network File Storage with Persistent Volume Claims in a Kubernetes cluster.

The following steps guide you through the process of connecting [<mark style="color:blue;">Network File Storage (NFS)</mark>](/cloud/backup-and-storage/network-file-storage.md) with Persistent Volume Claims (PVCs) in a Managed Kubernetes cluster.

**Prerequisites:**

* Ensure that the NFS volume and the Managed Kubernetes node pool are connected to the same private LAN.
* Node pools can only retrieve their IP addresses in the private LAN using Dynamic Host Configuration Protocol (DHCP). Each private LAN has its own subnet distributed by the DHCP server.
* The subnet of a private LAN becomes visible using the API when attaching a server to the LAN with a NIC, or by opening a node shell on the Kubernetes Cluster and inspecting the network interfaces.

To connect NFS with PVCs in a Managed Kubernetes cluster using the DCD (Data Center Designer), follow these steps:

1. Drag a `vCPU Server` into the workspace to add a new server in the DCD.
2. Click **Add NIC**. This action creates a new Network Inteface Controller (NIC) with a new private LAN. Note the LAN number.
3. Click **PROVISION CHANGES**.
4. Once the changes are provisioned, inspect the server’s NIC to see its primary IP in the private LAN. For example, `10.7.228.11`. This reveals the private LAN’s DHCP subnet. For example, `10.7.228.0/24`.
5. Provision a Kubernetes Cluster.
6. Provision a node pool for the Kubernetes Cluster and attach the previously created private LAN. Ensure that DHCP is active.
7. Provision an NFS Cluster with the same private LAN Attached.
8. Assign a static IP to the NFS cluster within the same subnet identified earlier. For example, `10.7.228.5/24`.
9. Provision an NFS Share. For more information, see [<mark style="color:blue;">Create Shares</mark>](/cloud/backup-and-storage/network-file-storage/how-tos/create-nfs-share.md).
10. Add the `10.7.228.0/24` subnet and a client group to establish the necessary permissions for Kubernetes and any other hosts within that subnet to access NFS.
11. Delete the `vCPU Server` created in the first step.

## Deploy an NFS Provisioner on Your Kubernetes Cluster

Choose one of the following NFS provisioners:

* [<mark style="color:blue;">nfs-subdir-external-provisioner</mark>](https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner)
* [<mark style="color:blue;">csi-driver-nfs</mark>](https://github.com/kubernetes-csi/csi-driver-nfs)

Both provisioners create a custom `StorageClass` configured with an NFS server. Use the static IP assigned earlier, for example, `10.7.228.5`, as the server and `/SHARE_UUID` as the share path. For more information, see [<mark style="color:blue;">Network File Storage</mark>](/cloud/backup-and-storage/network-file-storage.md).

Example full mountpath of a NFS share: 10.7.228.5:7b1ef56d-dfc6-51fe-aff0-7af2d6747868

## Configure StorageClass for Managed Kubernetes

Managed Kubernetes requires a specific setting for the `StorageClass` because PersistentVolumes need a specific mount setting. Apply the following command:

```bash
kubectl patch storageclass nfs-client -p '{"mountOptions": ["soft"]}'
```

## Using nfs-subdir-external-provisioner

Refer to the [<mark style="color:blue;">nfs-subdir-external-provisioner documentation</mark>](https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/blob/master/charts/nfs-subdir-external-provisioner/README.md) for detailed instructions.

When creating PVCs, specify the custom `StorageClass` name. The PVCs should then get provisioned using the specified provisioner.

## Using csi-driver-nfs

Install the helm chart for `csi-driver-nfs`:

```bash
helm repo add csi-driver-nfs https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts
helm install csi-driver-nfs csi-driver-nfs/csi-driver-nfs --namespace kube-system --version v4.8.0
```

Create a `StorageClass` with the necessary parameters:

```yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: nfs-csi
provisioner: nfs.csi.k8s.io
parameters:
  server: <nfs-ip>
  share: <share-name>
reclaimPolicy: Delete
volumeBindingMode: Immediate
mountOptions:
  - nfsvers=4.1
```

Create a PVC:

```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: <name-of-your-pvc>
```

{% hint style="success" %}
**Result:** The Managed Kubernetes cluster can now mount NFS volumes as PVCs.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ionos.com/cloud/containers/managed-kubernetes/how-tos/mount-an-nfs-volume.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
