Use an existing NFS Server as a Volume

Step by step guide to making an existing NFS available as a volume in your containers.


A common scenario involves using a Network File System (NFS) Server to provide access to shared data for multiple workloads in an application. Examples include storing files that have been uploaded from users by one service for processing in another or data provided by an external batch processing system running outside of the Kubernetes cluster.

In this tutorial we will create a Static Resource Definition in Humanitec to allow an already running NFS Server to be accessed as a volume from a container running in a Workload.

You will require:

  • An account with the Administrator role on your organization.

  • An App set up in Humanitec.

  • A running NFS Server that is accessible from the cluster you are deploying to.

Setting up a Static Resource for the NFS

Create the Static Resource Definition

Navigate to the Static Definitions section of the Organization Settings screen in Humanitec.

  1. Add a new Persistent Volume resource type

  2. Choose an ID to identify this resource definition later.

  3. Select the nfs driver

  4. Provide the path of the filesystem to mount on the NFS server

  5. Provide the IP or DNS name of the NFS Server

  6. Click the Create button to create the definition.

Step 1 of creating the static resource definition
Steps 2-6 of creating the static resource definition

Match the definition to an environment type

In order have control over which environments will use the NFS server, you can match it to an environment type.

  1. Click the âž• button in the Environment Type Column

  2. Choose the Environment Type to match the resource definition to.

Match the definition to an environment type

Using the NFS in an Application

Add a Volume as a Resource Dependency

Navigate to the Workload Details Screen for the Workload you want to make the volume available for. Make sure you are in Draft mode.

  1. Add a "Persistent Volume" resource by selecting from the dropdown in the Resource Dependencies section of the Container Panel.

  2. Choose an ID for the volume. You will use this to identify the volume when you setup volume mounts in your containers.

Add a Volume as a Resource Dependency

Define a Volume Mount for a container

Select the container that you want to configure a mount for.

  1. Select the ID you chose in the previous step

  2. Choose the path to mount the volume on. The path must be rooted and cannot be in the root of the filesystem.

  3. Choose whether the mount should be writable by the container.

  4. Optional. Choose a sub-directory in the NFS to mount instead of the root.

  5. Click the Create button to add the volume mount to the container.

Add volume mount