itzg / minecraft-server-charts

MIT License
267 stars 142 forks source link

subPath on volumeMounts #169

Open rzumbado opened 1 year ago

rzumbado commented 1 year ago

Hi there, is there a way to mount the /data dir using a subPath within the volumeMounts? I want to store the data within a sub folder on my PVC like: /games/minecraft/instance1/data rather than just /data.

volumeMounts:
    - name: datadir
      mountPath: /data
      subPath: /games/minecraft/instance1/data
itzg commented 1 year ago

From the looks of that path I believe you're thinking of a https://kubernetes.io/docs/concepts/storage/volumes#hostpath, which is what you'll declare in the https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#volumes part of the pod not the mount within the container. That'll be the extraVolumes in the chart values.

TheAceMan commented 9 months ago

I am using an smb share but you should be able to accomplish similar with the existing pvc that you have. I'm using the minecraft helm chart.

    persistence:
      dataDir:
        enabled: true
        mountPath: /data
        existingClaim: "minecraft-smb-data-pvc"
        subPath: instance1/data