no persistent volumes available for this claim and no storage class is set

9/7/2018

my pvc.yaml

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: database-disk
  labels:
    stage: production
    name: database
    app: mysql
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 2Gi

when i ran kubectl apply -f pvc.yaml i got the following error Normal FailedBinding 12h (x83 over 13h) persistentvolume-controller no persistent volumes available for this claim and no storage class is set

same pvc worked fine on "GKE" (Google Kubernetes Engine) but failing in my local cluster using microk8s

-- invariant
kubernetes

1 Answer

9/10/2018

Did you create any PV in your cluster?

PV and Storage classes on local clusters should be done manually by cluster admin.

Check out Kubernetes documentation for the details:

  1. A cluster administrator creates a PersistentVolume that is backed by physical storage. The administrator does not associate the volume with any Pod.

  2. A cluster user creates a PersistentVolumeClaim, which gets automatically bound to a suitable PersistentVolume.

  3. The user creates a Pod that uses the PersistentVolumeClaim as storage.

-- VAS
Source: StackOverflow