kubernetes no storageclass found

6/19/2018

I'm trying to deploy a mysql instance on my single-node-cluster but it's still in pending.

kubectl describe pod mysql-59777f9bf8-ghnss
.....
Events:
  Type     Reason            Age                 From               Message
  ----     ------            ----                ----               -------
  Warning  FailedScheduling  3m (x125 over 38m)  default-scheduler  pod has unbound PersistentVolumeClaims

If i try to describe pvc I'll get

kubectl describe pvc mysql
...
Type    Reason         Age                 From                         Message
  ----    ------         ----                ----                         -------
  Normal  FailedBinding  4m (x143 over 39m)  persistentvolume-controller  no persistent volumes available for this claim and no storage class is set

And if I try to get storageClasses I'll get

kubectl get storageclass
No resources found.

I'm using kubernetes over Docker (Docker version 18.05.0-ce, build f150324) on Azure machine

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.4", GitCommit:"5ca598b4ba5abb89bb773071ce452e33fb66339d", GitTreeState:"clean", BuildDate:"2018-06-06T08:13:03Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.4", GitCommit:"5ca598b4ba5abb89bb773071ce452e33fb66339d", GitTreeState:"clean", BuildDate:"2018-06-06T08:00:59Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

I can't understand how I fix this. Thanks in advance

-- Claudio Pomo
docker
kubernetes

1 Answer

6/19/2018

The issue is clearly stated from the error no storage class is set: a volume cannot be created because the claim for that volume is using a storageclass that does not exist.

Create a storageclass that satisfy your requirements so that the volumeclaim can bind a volume.

An example for Azure:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: slow
provisioner: kubernetes.io/azure-disk
parameters:
  storageaccounttype: Standard_LRS
  kind: Shared

More about this here: https://kubernetes.io/docs/concepts/storage/storage-classes/

Although as it is stated in the first line you should get familiar with

https://kubernetes.io/docs/concepts/storage/volumes/

and

https://kubernetes.io/docs/concepts/storage/persistent-volumes/

first.

-- iomv
Source: StackOverflow