Deploying Network File System


Network File System (NFS) is a distributed file system protocol where you can access files over a network, for instance, accessing local storage. An NFS server makes its storage resources available to you on the network. To access an NFS server, you must mount the shared directories from the server onto your local file system. Doing so lets you interact with the remote files as if they were local.

NFS is a prerequisite for data storage and sharing in the Kubernetes environment, facilitating data consistency, scalability, and centralized management. Kubernetes uses Persistent Volumes (PVs) to store data. You can use NFS to provide these PVs. NFS also performs backups and data recovery. You can regularly back up the NFS data to make sure data resilience in case of failures.

Use the following procedure to create NFS volumes and deploy the NFS subdirectory provisioner:

To create NFS volumes

  1.  Use SSH to log in to the NFS server.
  2. Create the required NFS directories on the server; for example, create a directory at /var/nfs/.

    bash
    mkdir -p /var/nfs/
  3. Set appropriate permissions for NFS clients to access the directories.

    bash
    chmod -R 755 /var/nfs/

  4. Append the NFS share location to the /etc/exports file to specify the directories that are shared with NFS clients.

    bash
    /var/nfs/ *(rw,sync,no_subtree_check,no_root_squash)
  5. Run the following command to update NFS exports and make them active:

    bash
    exportfs -rv

To deploy the NFS subdirectory external provisioner Helm

This configuration is a one-time setup that is essential for new clusters. The NFS subdirectory external provisioner is an automated Kubernetes provisioner that leverages your pre-configured NFS server to generate Persistent Volumes autonomously.

  1. Add the helm repository for the NFS subdirectory external provisioner:

    bash
    helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/
  2. Install the NFS subdirectory external provisioner by using helm and replace x.x.x.x with the actual NFS server IP and /exported/path with the NFS path you configured.

    bash
    helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner --set nfs.server=x.x.x.x --set nfs.path=/exported/path

    This chart deploys a custom storage class in a Kubernetes cluster through the Helm package manager. It also installs an NFS client provisioner in the cluster, enabling the dynamic creation of persistent volumes from a single NFS share. You need Kubernetes version 1.9 or later or an existing NFS share. 

  3. To deploy the NFS subdirectory external provisioner helm chart, verify the storage class by using the following command:

    > kubectl get sc

To install Helm charts with the release name

  1. Install the helm chart with a custom name to specify a version name.
  2. Replace my-release, x.x.x.x, and /exported/path

    bash
    helm install my-release nfs-subdir-external-provisioner/nfs-subdir-external-provisioner --set nfs.server=x.x.x.x --set nfs.path=/exported/path

    The command deploys the specified storage class by using the default name nfs-client in its default configuration. You can use this storage class for provisioning persistent volumes.

    If the cluster already has storage and provisioners with the same name, refer to this section for guidance on installing multiple provisioners for different NFS servers or exports.

  3. Make sure to note the storage class name because you need this class name as an input parameter in the deploy.sh script.

 To install multiple provisioners for different NFS servers or exports

Each provisioner must have a different storageClass.provisionerName and a different storageClass.name. This provision allows you to create distinct storage classes for various NFS configurations. Use the NFS subdirectory external provisioner Helm chart to dynamically provision persistent volumes (PVs) on an NFS server for Kubernetes clusters.

With the NFS Subdirectory, you can automatically create and manage the storage resources in the NFS server to fulfill the storage requirements of applications running in the Kubernetes environment. This helm Chart streamlines the storage provisioning process for containers and ensures efficient use of NFS resources.

As shown in the example, use the following steps if you have multiple storage requirements and data sources in your Kubernetes cluster.

  1. Install the NFS subdirectory external provisioner by using helm.
  2. Replace x.x.x.x with the actual NFS server IP and /exported/path with the NFS path you configured.

    bash
    helm install second-nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner --set nfs.server=y.y.y.y --set nfs.path=/other/exported/path --set storageClass.name=second-nfs-client --set storageClass.provisionerName=k8s-sigs.io/second-nfs-subdir-external-provisioner

Where to go from here

Deploying the BMC Helix Edge core on premises

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*