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

My MySQL service/pod/deployment “hangs” in pending state:

NAME                        READY   STATUS    RESTARTS   AGE
pod/mysql-b94654bd4-4874d   0/1     Pending   0          16m

NAME                 TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
service/kubernetes   ClusterIP   10.152.183.1     <none>        443/TCP    19m
service/mysql        ClusterIP   10.152.183.133   <none>        3306/TCP   16m

NAME                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/mysql   0/1     1            0           16m

NAME                              DESIRED   CURRENT   READY   AGE
replicaset.apps/mysql-b94654bd4   1         1         0       16m

Cluster information:

Kubernetes version: microk8s v1.17.0 1107 stable canonical✓ classic
Cloud being used: Virtualbox VM
Installation method: Snap

Host OS:
root@docker1:~/scdf-monitoring/spring-cloud-dataflow# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.10
Release: 19.10
Codename: eoan

src/kubernetes/mysql/mysql-secrets.yaml

apiVersion: v1
kind: Secret
metadata:
  name: mysql
  labels:
    app: mysql
data:
  mysql-root-password: eW91cnBhc3N3b3Jk

src/kubernetes/mysql/mysql-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
  labels:
    app: mysql
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - image: mysql:5.7.25
        name: mysql
        env:
          - name: MYSQL_ROOT_PASSWORD
            valueFrom:
              secretKeyRef:
                key: mysql-root-password
                name: mysql
        ports:
          - containerPort: 3306
            name: mysql
        volumeMounts:
          - name: data
            mountPath: /var/lib/mysql
        args:
          - "--ignore-db-dir=lost+found"
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: mysql

src/kubernetes/mysql/mysql-svc.yaml

apiVersion: v1
kind: Service
metadata:
  name: mysql
  labels:
    app: mysql
spec:
  ports:
    - port: 3306
  selector:
    app: mysql

src/kubernetes/mysql/mysql-pvc.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql
  labels:
    app: mysql
  annotations:
    volume.alpha.kubernetes.io/storage-class: default
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 8Gi

Hi,

Did you enable storage when setting up microk8s?

Did you create a StorageClass? Maybe that’s not needed in 1.17, but I guess your pvc would be claiming default storage class…?

Here’s step-by-step instructions for rbac+storage on microk8s 1.15, might be helpful?