<p>I'm fairly new to k8s, so forgive me if I misuse k8s terminology. I'm hoping someone could point me in the right direction and advise the best way to do this.</p>

<p>I have a k8s cluster running on a group of raspberry pis. I want to add a database volume accessible by all workers. I plan to use a usb external drive to store the database content.</p>

<p>Do I want to mount the external drive to the master node?</p>

<p>How is the external drive declared as a k8s resource?</p>

<p>Once configured, how is this external drive accessible by pods in other k8s nodes?</p>

<p>After reading through k8s Volumes page, it sounds like I might be looking for a Volume of "local" type. If I mount a local volume to the master node, will I be able to run a postgres container in a worker node and access the volume mounted on the master node?</p>

<p>Easiest thing is to <a href="https://www.htpcguides.com/configure-nfs-server-and-nfs-client-raspberry-pi/" rel="nofollow noreferrer">set up NFS server</a> on master node, export your USB drive over NFS and then mount it as Persistent Volume in pod. For this you need first to create PersistentVolume:</p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs
spec:
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteMany
  nfs:
    server: master-node-ip
    path: /mnt/nfsserver
</code></pre>

<p>And then create PersistentVolumeClaim of the same size:</p>

<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nfs
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: ""
  resources:
    requests:
      storage: 5Gi
</code></pre>

<p>After that you can mount this PVC on all needed pods:</p>

<pre><code>    volumeMounts:
    - name: nfs
      mountPath: "/usr/share/nginx/html"
  volumes:
  - name: nfs
    persistentVolumeClaim:
      claimName: nfs
</code></pre>
