Adding Database to raspberry pi kubernetes cluster
Easiest thing is to set up NFS server 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:
apiVersion: v1kind: PersistentVolumemetadata: name: nfsspec: capacity: storage: 5Gi accessModes: - ReadWriteMany nfs: server: master-node-ip path: /mnt/nfsserver
And then create PersistentVolumeClaim of the same size:
apiVersion: v1kind: PersistentVolumeClaimmetadata: name: nfsspec: accessModes: - ReadWriteMany storageClassName: "" resources: requests: storage: 5Gi
After that you can mount this PVC on all needed pods:
volumeMounts: - name: nfs mountPath: "/usr/share/nginx/html" volumes: - name: nfs persistentVolumeClaim: claimName: nfs
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?
No. You will need to run something to make your volume accessible to other nodes. There are tons of filesystems for that purpose (Ceph, Lustre, even NFS, etc.) And there are starting to be Kubernetes native ones too (i.e. Rook.)