Skip to main content
Version: 2.0

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/v1
kind: StorageClass
metadata:
name: cinder
provisioner: kubernetes.io/cinder
reclaimPolicy: Delete
parameters:
availability: nova

/assets/k8s/cinder10.png

Now we able to use Cinder Volume as storage class

/assets/k8s/cinder09.png

Create a PVC

/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: v1
kind: Pod
metadata:
name: my-cinder-pv-pod-1
spec:
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

root@my-cinder-pv-pod-1:/# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 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
root@my-cinder-pv-pod-1:/# cd /usr/share/nginx/html/
root@my-cinder-pv-pod-1:/usr/share/nginx/html# ls
lost+found
root@my-cinder-pv-pod-1:/usr/share/nginx/html# echo "bigstack.co" >> index.html
root@my-cinder-pv-pod-1:/usr/share/nginx/html# cat index.html
bigstack.co
root@my-cinder-pv-pod-1:/usr/share/nginx/html#

Check point

  • The cinder volume has been attached to your cluster

/assets/k8s/cinder02.png