Creating Persistent Volume Results in storageclass.storage.k8s.io "fast" not found

4/16/2018

I installed kubernetes on two Centos7 VMs using kubeadm.

I am trying to follow the Example: Deploying Cassandra with Stateful Sets or Scalable-Cassandra-deployment-on-kubernetes samples.

Creating the local volumes works but kubectl get pvc always results in a status of Pending. kubectl descrive pvc <*pvc name*> results in the following warning:

Events:
Type     Reason              Age                   From                         Message
----     ------              ----                  ----                         -------
Warning  ProvisioningFailed  54s (x16854 over 2d)  persistentvolume-controller  storageclass.storage.k8s.io "fast" not found

I'm uncertain how to create the "fast" storage class to enable the volume to be successfully created and complete the samples.

-- Flea
kubeadm
kubernetes
kubernetes-pvc

1 Answer

4/16/2018

When you create a persistent Volume you have to make sure that the corresponding storage class exist.

A StorageClass provides a way for administrators to describe the “classes” of storage they offer. Different classes might map to quality-of-service levels, or to backup policies, or to arbitrary policies determined by the cluster administrators. Kubernetes itself is unopinionated about what classes represent. This concept is sometimes called “profiles” in other storage systems.

For example in the guide you linked at the bottom of the yaml file you find:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: fast
provisioner: k8s.io/minikube-hostpath
parameters:
  type: pd-ssd

This is the definition of the storage class, the api and the provisioner makes sure how it get mapped to the actual storage and depends on the Kubernetes implementation and where it is running.

Therefore you should double check if you declared the storage class:

$ kubectl get storageclasses --all-namespaces

If you do not have a storage class you should create it specifying the correct provisioner or if it merely a test you can consider to create the volume claim of a storage class you already have.

Example

For example running on Google Kubernetes Engine I have by default a standard class. Trying to deploy a claim I have as well a pending error message.

Deploying the following yaml file(and note that the provisioned changed) I am able to successfully create the persistent volume claim since now Kubernetes knows what I mean with type "fast":

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: fast
provisioner: kubernetes.io/gce-pd  
parameters:
  type: pd-ssd
  zones: us-central1-a, us-central1-b
-- GalloCedrone
Source: StackOverflow