Automatic Storage Provision


title: “Automatic Storage Provision”
date: 2018-08-24T12:54:32
slug: automatic-storage-provision


Create a Stroage Class (will be the default one):

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
 annotations:
 storageclass.kubernetes.io/is-default-class: "true"
 name: fast-disks
provisioner: kubernetes.io/no-provisioner
reclaimPolicy: Delete
volumeBindingMode: Immediate

Create the Storage Directories on the Host

mkdir /mnt/disks
 for vol in vol1 vol2 vol3; do
 mkdir /mnt/disks/$vol
 mount -t tmpfs $vol /mnt/disks/$vol
done

Creating local persistent volumes (The created Pod will present eachStorage directory as a PV)
This script is from https://github.com/kubernetes-incubator/external-storage/tree/master/
The values can be adapted in values.yaml

helm template ./helm/provisioner > ./provisioner/deployment/kubernetes/provisioner\_generated.yaml
kubectl create -f ./provisioner/deployment/kubernetes/provisioner\_generated.yaml

The PV can be blaimed by the storage class fast-disks.
The Size of the PV must be equal or greater the the claimed size.
The PV Size can be set via the mounted tmpfs size (eg: mount -t tmpfs -o size=10G vol3 /DATA/vol3)

Print Friendly, PDF & Email