Search code examples
raspberry-picluster-computingkubernetes-helmnode-redk3s

How to change helm value for persistance to use a path on a certain node


I'm just learning k3s and Helm using a raspberry pi cluster. I have added a thumbdrive to one of the workers and given it a path like /mnt/thumb and I want to store my data from Node red here (actually I have data in this directory that I want it to use). But I can't seem to change the helm chart to point to the path on that specific node to make that happen. I'm using this values.yaml. I've tried following different instructions but none of them have worked. Can someone please show me an example of how to do this? Thanks in advance


Solution

  • I am using the following approach for mounting a specific folder into a pod using persistent volume claims with kurlsh. It should also work with k3s on a raspberry:

    Before installing your helm chart, create a new Persistent volume from the following yaml:

    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: local-volume
    spec:
      capacity:
        storage: 20Gi
      accessModes:
      - ReadWriteOnce
      storageClassName: local-volume
      hostPath:
        path: /mnt/thumb
    

    What you're doing there is essentially creating a kubernetes volume backed by a folder on your filesystem and assigning a storage class to it ( and a size ). Next, you will need to tell your helm chart to create a new PersistentVolumeClaim using the storageClass you've just created. To do that, fill in the persistence section of the values.yaml as follows:

    persistence:
      enabled: true
      storageClass: "local-volume"
      accessMode: ReadWriteOnce
      size: 20Gi
    

    Make sure that the size of the volume matches in both the PersistentVolume and the values.yaml.

    You will need to take a closer look at the folder structure inside the persistent Volume and also make sure, that the folder's permissions are set so that your pod can actually write data into said folder, but that should be enough to get you started, without relying on fancy third party storage solutions.