You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

While running a kubernetes-cluster it might prove useful to use cinder as a provider for persistent volumes within Kubernetes. The following guide helps you achieve this. The guide assumes that you are using a kubernetes-cluster deployed by Openstack Magnum.

Defining Storage-class

First a storage-class needs to be defined. This can be achived by creating a file with the following content:

Define a storage-class for Cinder
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: cinder
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/cinder

This config-file will make the cinder-class the default Storage-class in your cluster. After the file is created the settings can be applied to kubernetes like so:

Apply settings to kubernetes
$ kubectl apply -f default-storage-cinder.yaml

The storage-class can be verified using the following command:

Verify settings in kubernetes
$ kubectl get storageclass
NAME               PROVISIONER            AGE
cinder (default)   kubernetes.io/cinder   97m

Labeling nodes in the cluster to allow mounting of the volumes

Kubernetes need a label on the minion-nodes to know that the cinder-volume can be mounted on them. To apply the label to all your minions you could use the following command:

Label nodes
$ for n in $(kubectl get node | grep minion | awk '{print $1}'); do kubectl label nodes $n failure-domain.beta.kubernetes.io/zone=nova; done
  • No labels