Skip to main content
Version: 2.1

Create Storage Class with Cinder Backend

Select your cluster#

/assets/k8s/cinder13.png

Select Storage Classes from Storage dropdown menu#

/assets/k8s/cinder12.png

Click on Import YAML#

/assets/k8s/cinder11.png

Paste the code and click import#

apiVersion: storage.k8s.io/v1kind: StorageClassmetadata:  name: cinderprovisioner: kubernetes.io/cinderreclaimPolicy: Deleteparameters:  availability: nova

/assets/k8s/cinder10.png

Now we able to use Cinder Volume as storage class#

/assets/k8s/cinder09.png

Create a PVC#

Navigate to your cluster default project#

/assets/k8s/cinder08.png

Switch to Volumes tab and click Add Volume#

/assets/k8s/cinder04.png

Select cinder from Storage Class and Create#

/assets/k8s/cinder05.png

Check point#

  • a volume has been created under Project > Volumes > Volumes

/assets/k8s/cinder01.png

Create a sample workload with pv/pvc#

apiVersion: v1kind: Podmetadata:  name: my-cinder-pv-pod-1spec:  volumes:    - name: my-cinder-pv-storage-1      persistentVolumeClaim:        claimName: pv  containers:    - name: task-pv-container-1      image: nginx      ports:        - containerPort: 80          name: "http-server"      volumeMounts:        - mountPath: "/usr/share/nginx/html"          name: my-cinder-pv-storage-1

Enter your workload shell and check up#

/assets/k8s/cinder03.png

Shell: task-pv-container-1#

[email protected]:/# lsblkNAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTsda       8:0    0   40G  0 disk |-sda1    8:1    0 39.9G  0 part /etc/hosts|-sda14   8:14   0    4M  0 part `-sda15   8:15   0  106M  0 part sdb       8:16   0   10G  0 disk /usr/share/nginx/html[email protected]:/# cd /usr/share/nginx/html/[email protected]:/usr/share/nginx/html# lslost+found[email protected]:/usr/share/nginx/html# echo "bigstack.co" >> index.html[email protected]:/usr/share/nginx/html# cat index.html bigstack.co[email protected]:/usr/share/nginx/html# 

Check point#

  • The cinder volume has been attached to your cluster

/assets/k8s/cinder02.png

Last updated on by Roy Tan