<p>I'm looking for a solution for Kubernetes storage where I can use my UnRaid server as storage for my Kubernetes cluster. Has anyone done anything like this?</p>

<p>Any help would be much appreciated.</p>

<p>Thanks,
Jamie</p>

<p>Probably the only way is to use it an <a href="https://kubernetes.io/docs/concepts/storage/volumes/#nfs" rel="nofollow noreferrer">NFS Volume</a>. This <a href="http://www.adfrad.com/2016/09/connecting-esxi-6-to-unraid-nfs-share.html" rel="nofollow noreferrer">link</a> gives you an idea on how to mount an Unraid NFS share. </p>

<p>Then you can follow the <a href="https://github.com/kubernetes/examples/tree/master/staging/volumes/nfs" rel="nofollow noreferrer">Kubernetes example</a> on how to use an NFS Volume in a Pod.</p>

<p>Basically, your Unraid server will have an IP address and then you can mount the volume/path using that IP address on your Pod. <a href="https://matthewpalmer.net/kubernetes-app-developer/articles/kubernetes-volumes-example-nfs-persistent-volume.html" rel="nofollow noreferrer">For example</a>:</p>

<pre><code>kind: Pod
apiVersion: v1
metadata:
  name: pod-using-nfs
spec:
  # Add the server as an NFS volume for the pod
  volumes:
    - name: nfs-volume
      nfs: 
        # URL for the NFS server
        server: 10.108.211.244 # Change this!
        path: /

  # In this container, we'll mount the NFS volume
  # and write the date to a file inside it.
  containers:
    - name: app
      image: alpine

      # Mount the NFS volume in the container
      volumeMounts:
        - name: nfs-volume
          mountPath: /var/nfs

      # Write to a file inside our NFS
      command: ["/bin/sh"]
      args: ["-c", "while true; do date &gt;&gt; /var/nfs/dates.txt; sleep 5; done"]
</code></pre>

<p>You can also use a <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims" rel="nofollow noreferrer">PVC</a> if you'd like. <a href="https://medium.com/platformer-blog/nfs-persistent-volumes-with-kubernetes-a-case-study-ce1ed6e2c266" rel="nofollow noreferrer">For example</a>:</p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  nfs:
    server: 10.108.211.244 # Change this!
    path: "/"

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

<p>Then use it in your Deployment or Pod definition:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nfs-busybox
spec:
  replicas: 1
  selector:
    matchLabels:
      name: nfs-busybox
  template:
    metadata:
      labels:
        name: nfs-busybox
    spec:
      containers:
      - image: busybox
        imagePullPolicy: Always
        name: busybox
        volumeMounts:
          # name must match the volume name below
          - name: my-pvc-nfs
            mountPath: "/mnt"
      volumes:
      - name: my-pvc-nfs
        persistentVolumeClaim:
          claimName: nfs
</code></pre>
