Create Storage Class with Cinder Backend
Select your cluster
Select Storage Classes
from Storage dropdown menu
Click on Import YAML
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
Now we able to use Cinder Volume as storage class
Create a PVC
Navigate to your cluster default project
Switch to Volumes tab and click Add Volume
Select cinder from Storage Class and Create
Check point
- a volume has been created under Project > Volumes > Volumes
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
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