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:
- Copy the following sample yaml from our c6o/sample-project repo
- Modify lines 40 and 50 to match your persistentVolumeClaim [PVC] and also match all the namespaces
- Apply the file and make sure the NFS Pod starts properly
- Run
czctl consume edit
and enter<namespace>/nfs-mount
- For convenience, make the namespace the primary namespace
czctl primary-namespace select <namespace>
- 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).