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.
Navigate to the Static Definitions section of the Organization Settings screen in Humanitec.
Add a new Persistent Volume resource type
Choose an ID to identify this resource definition later.
Provide the path of the filesystem to mount on the NFS server
Provide the IP or DNS name of the NFS Server
Click the Create button to create the definition.
In order have control over which environments will use the NFS server, you can match it to an environment type.
Click the ➕ button in the Environment Type Column
Choose the Environment Type to match the resource definition to.
Add a "Persistent Volume" resource by selecting from the dropdown in the Resource Dependencies section of the Container Panel.
Choose an ID for the volume. You will use this to identify the volume when you setup volume mounts in your containers.
Select the container that you want to configure a mount for.
Select the ID you chose in the previous step
Choose the path to mount the volume on. The path must be rooted and cannot be in the root of the filesystem.
Choose whether the mount should be writable by the container.
Optional. Choose a sub-directory in the NFS to mount instead of the root.
Click the Create button to add the volume mount to the container.