Openebs and MinIO

No frills K8s lab notes

No frills K8s lab notes on deploying openebs and using for MinIO storage.

Download openebs

Download the openebs operator lite version if you intend to only use hostpath and block storage provisioners. That’s my jam yo.

Download openebs
$ curl -OL https://openebs.github.io/charts/openebs-operator-lite.yaml
$ curl -OL https://openebs.github.io/charts/openebs-lite-sc.yaml

Customize storage location

Customize the deployment per your tastes.

By default openebs provisions local volumes under /var/openebs/local. My K8s nodes have storage mounted at /data, so I customize the value of OPENEBS_IO_BASE_PATH to /data/openebs.

Configure storage location
# openebs-operator-lite.yaml - note only relevant elements shown
apiVersion: apps/v1
kind: Deployment
metadata:
  name: openebs-localpv-provisioner
  namespace: openebs
spec:
  template:
    spec:
      containers:
      - name: openebs-provisioner-hostpath
        env:
        - name: OPENEBS_IO_BASE_PATH
          value: "/data/openebs"

Customize the storage class config per your tastes.

For my setup I need to change the BasePath to /data/openebs/.

StorageClass
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: openebs-hostpath
  annotations:
    openebs.io/cas-type: local
    cas.openebs.io/config: |
      - name: StorageType
        value: "hostpath"
      - name: BasePath
        value: "/data/openebs/"
provisioner: openebs.io/local
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Delete

Deploy openebs

Deploy openebs and storage classes.

Deploy operator
$ kubectl apply -f ./openebs-operator-lite.yaml
$ kubectl apply -f ./openebs-lite-sc.yaml

Verify openebs localpv provisioner, ndm components and storage classes are ready.

Verify objects
$ kubectl get pods -n openebs

NAME                           READY   STATUS    RESTARTS   AGE
openebs-localpv-provisioner    1/1     Running   0          116s
openebs-ndm                    1/1     Running   0          116s
openebs-ndm-cluster-exporter   1/1     Running   0          116s
openebs-ndm-node-exporter      1/1     Running   0          116s
openebs-ndm-operator           1/1     Running   0          116s

$ kubectl get sc

NAME               PROVISIONER        RECLAIMPOLICY   VOLUMEBINDINGMODE     AGE
openebs-device     openebs.io/local   Delete          WaitForFirstConsumer  114s
openebs-hostpath   openebs.io/local   Delete          WaitForFirstConsumer  114s

Deploy MinIO

Deploy a stateful workload.

A single server MinIO deployment configured to use openebs-hostpath is provided to test the openebs installation.

Deploy MinIO
$ kubectl apply -f ./minio-openebs.yml

Open the MinIO console and add an object. Perhaps something fun like a video of your four legged friends.

MinIO OpenEBS

Sanity check openebs.

If you have access to your K8s node, pop into it and verify it contains data from the MinIO deployment.

Sanity check
# SSH into the K8s node running the MinIO pod.
$ cd /data/openebs/
$ ls -lh pvc-eabb8cdb-2ed6-4f37-b461-7f986f421f1f/test-bucket/
-rw-r--r-- 1 root root 84M Dec 30 19:31 four-legged-friends.mp4

References

  1. OpenEBS Quickstart
  2. MinIO Docs