I move kubernetes from Google GKE to own in house rack. What persistent storage should I use?
Kubernetes Local Persistent became beta in 13th of April 2018 only https://kubernetes.io/blog/2018/04/13/local-persistent-volumes-beta/
I have seen that many options:- https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes
Not sure what should I choose. Will something work out box with GKE deployment files?
In Deployment files from GKE, you need to change spec.volumes
settings according to your Persistent Volume setups.
I recommend you to choose one of the following options:
The easiest way is to use HostPath
. 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:
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
You can use NFS
. 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:
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 > /mnt/index.html; hostname >> /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
You can look through the link for more information about using NFS.
You can use GlusterFS
. You need to configure your own GlusterFS installation, and after that you can use its volumes in Deployments. Example of usage in Kubernetes:
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 > /mnt/index.html; hostname >> /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
You can look through the link for more information about using GlusterFS.
You can find more information about Persistent Volumes and Persistent Volume Claims here.