Skip to main content

Mounting an In-Cluster Volume

When using Codezero to consume a remote service, traffic is intercepted and sent to the local process. But let's say you have a kubernetes operator which depends on a resource in a mounted directory in the cloud - like a storage class files needed to execute. To allow the consumed process access to the files on the remote volume follow these steps.

Here's the procedure using an NFS Mount:

  1. Copy the following sample yaml from our c6o/sample-project repo
  2. Modify lines 40 and 50 to match your persistentVolumeClaim [PVC] and also match all the namespaces
  3. Apply the file and make sure the NFS Pod starts properly
  4. Run czctl consume edit and enter <namespace>/nfs-mount
  5. For convenience, make the namespace the primary namespace czctl primary-namespace select <namespace>
  6. You should be able to now mount the volume locally using NFS mount -t nfs nfs-mount:/usr/src/app/data ~/mnt

The above assumes you want the path /usr/src/app/data (defined in the yaml) and that you have a local mountpoint ~/mnt

For more resiliency, you can use a Deployment instead of a Pod. Codezero tunnels to the Service (not the Pod) so the above will work even a single NFS Pod fails.

If you have any further questions - please reach out to us via [email protected] or Discord or your dedicated Slack Connect channel (if you're an Enterprise Customer).