Állandó openebs storage létrehozása clusteren :

microk8s enable community
microk8s enable openebs

A storage class osztályok:

  kubectl get sc
NAME                       PROVISIONER           RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
openebs-device             openebs.io/local      Delete          WaitForFirstConsumer   false                  20h
openebs-jiva-csi-default   jiva.csi.openebs.io   Delete          Immediate              true                   20h
openebs-hostpath           openebs.io/local      Delete          WaitForFirstConsumer   false                  20h

5 GB tároló létrehozása :

op_ebs.yaml

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: jiva-volume-claim
spec:
  storageClassName: openebs-jiva-csi-default
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5G

microk8s kubectl apply -f op_ebs.yaml

Kész az 5 GB-os állandó tár:
microk8s kubectl get -pv -o wide

Teszteléshez fio.yaml, futtatása: microk8s kubectl apply -f fio.yaml :

apiVersion: apps/v1
kind: Deployment
metadata:
  name: fioa
spec:
  selector:
    matchLabels:
      name: fioa
  replicas: 1
  strategy:
    type: Recreate
    rollingUpdate: null
  template:
    metadata:
      labels:
        name: fioa
    spec:
      containers:
      - name: perfrunner
        image: openebs/tests-fio
        command: ["/bin/bash"]
        args: ["-c", "while true ;do sleep 50; done"]
        volumeMounts:
        - mountPath: /datadir
          name: fio-vol
      volumes:
      - name: fio-vol
        persistentVolumeClaim:
          claimName: jiva-volume-claim


Ha kész, belépés a pod-ba (fioa-5c7f8598f6-c5d85) :

kubectl exec --stdin --tty fioa-5c7f8598f6-c5d85   -- /bin/bash

df -h

vagy lsblk -val :

Tags