Cloud-Native Storage for Kubernetes
Multitude of options
There are multitude of options both free and paid. I’ll consider only the free ones.
- Hetzner CSI driver hetznercloud/csi-driver that makes it possible to provision Hetzner Cloud volumes directly.
- OpenEBS
- Rook
- Rancher Longhorn is alpha-quality software
- Linstor
Paid ones are: Portworx, StorageOS, Robin.io
Source:
Undestand the basics
If we don’t have storage installed, the pods will be in constant “pending” state.
To check if we have the default storage class:
kubectl get storageclass
Set default StorageClass
If not specified in manifest, cluster can use default storageclass
. As nothing is normally set as default, we do it by adding some metadata:
# Make `openebs-standalone` the default
kubectl patch storageclass openebs-standalone -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
Source: Change the default StorageClass
A PersistentVolume can be mounted on a host in any way supported by the resource provider.
accessModes:
- ReadWriteOnce – the volume can be mounted as read-write by a single node
- ReadOnlyMany – the volume can be mounted read-only by many nodes
- ReadWriteMany – the volume can be mounted as read-write by many nodes
We can use hostpath but that is bound to one node.
Deploy OpenEBS
kubectl apply -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/openebs-operator.yaml
kubectl apply -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/openebs-storageclasses.yaml
Kubernetes Persistent Volumes with Deployment and StatefulSet
What? Currently looking at that rook.io because I need a “readwriteMany” PVC (A Webroot where multiple PODs need access to) and OpenEBS does not support multiple pods using the same PVC.