<p>I move kubernetes from Google GKE to own in house rack. What persistent storage should I use?</p>

<p>Kubernetes Local Persistent became beta in 13th of April 2018 only
<a href="https://kubernetes.io/blog/2018/04/13/local-persistent-volumes-beta/" rel="nofollow noreferrer">https://kubernetes.io/blog/2018/04/13/local-persistent-volumes-beta/</a></p>

<p>I have seen that many options:-
<a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes</a></p>

<p>Not sure what should I choose. Will something work out box with GKE deployment files?</p>

user3130782
<p>In Deployment files from GKE, you need to change <code>spec.volumes</code> settings according to your Persistent Volume setups.</p>

<p>I recommend you to choose one of the following options:</p>

<ol>
<li><p>The easiest way is to use <code>HostPath</code>. It mounts a file or a directory from the host Node’s file system into your Pod. Note that in this case, data on one Node is not reachable from another Node without additional configurations. Example of usage in Kubernetes:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test-pd
spec:
  containers:
  - image: k8s.gcr.io/test-webserver
    name: test-container
    volumeMounts:
    - mountPath: /test-pd
      name: test-volume
  volumes:
  - name: test-volume
    hostPath:
      # directory location on host
      path: /data
      # this field is optional
      type: Directory
</code></pre></li>
<li><p>You can use <code>NFS</code>. You need to configure NFS server and after that you can use its volumes in Deployments via Persistent Volume Claims. Example of usage in Kubernetes:</p>

<pre><code>apiVersion: v1
kind: Deployment
metadata:
  name: nfs-busybox
spec:
  replicas: 2
  selector:
    name: nfs-busybox
  template:
    metadata:
      labels:
        name: nfs-busybox
    spec:
      containers:
     - image: busybox
        command:
          - sh
          - -c
          - 'while true; do date &gt; /mnt/index.html; hostname &gt;&gt; /mnt/index.html; sleep $(($RANDOM % 5 + 5)); done'
        imagePullPolicy: IfNotPresent
        name: busybox
        volumeMounts:
          # name must match the volume name below
          - name: nfs
            mountPath: "/mnt"
      volumes:
      - name: nfs
        persistentVolumeClaim:
          claimName: nfs
</code></pre>

<p>You can look through the <a href="https://github.com/kubernetes/examples/tree/master/staging/volumes/nfs" rel="nofollow noreferrer">link</a> for more information about using NFS.</p></li>
<li><p>You can use <code>GlusterFS</code>. You need to configure your own GlusterFS installation, and after that you can use its volumes in Deployments. Example of usage in Kubernetes:</p>

<pre><code>apiVersion: v1
kind: Deployment
metadata:
  name: nfs-busybox
spec:
  replicas: 2
  selector:
    name: nfs-busybox
  template:
    metadata:
      labels:
        name: nfs-busybox
    spec:
      containers:
     - image: busybox
        command:
          - sh
          - -c
          - 'while true; do date &gt; /mnt/index.html; hostname &gt;&gt; /mnt/index.html; sleep $(($RANDOM % 5 + 5)); done'
        imagePullPolicy: IfNotPresent
        name: busybox
        volumeMounts:
          # name must match the volume name below
          - name: nfs
            mountPath: "/mnt"
      volumes:
      - name: glusterfsvol
        glusterfs:
          endpoints: glusterfs-cluster
            path: kube_vol
            readOnly: true
</code></pre>

<p>You can look through the <a href="https://github.com/kubernetes/examples/tree/master/staging/volumes/glusterfs" rel="nofollow noreferrer">link</a> for more information about using GlusterFS.</p></li>
</ol>

<p>You can find more information about Persistent Volumes and Persistent Volume Claims <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims" rel="nofollow noreferrer">here</a>.</p>
