kubernetespersistent-volumes

Why does Kubernetes not find any StorageClass even though it seems to exist?


I have Bound PVs for the storage class local-storage which IMO proves that the storage class exists:

$ kubectl get pv -n example-com
NAME               CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                            STORAGECLASS    REASON   AGE
db-worker-1        10Gi       RWO            Retain           Bound    example-com/cluster-pg-3          local-storage            2d20h
db-worker-1-loki   10Gi       RWO            Retain           Bound    example-com/data-loki-backend-0   local-storage            14m
db-worker-2        10Gi       RWO            Retain           Bound    example-com/cluster-pg-1          local-storage            2d20h
db-worker-2-loki   10Gi       RWO            Retain           Bound    example-com/data-loki-backend-2   local-storage            14m
db-worker-3        10Gi       RWO            Retain           Bound    example-com/cluster-pg-2          local-storage            2d20h
db-worker-3-loki   10Gi       RWO            Retain           Bound    example-com/data-loki-backend-1   local-storage            14m

Also, I have PVCs for local-storage, some of which are Bound and others are Pending:

$ kubectl get pvc -n example-com
NAMESPACE    NAME                            STATUS    VOLUME             CAPACITY   ACCESS MODES   STORAGECLASS    AGE
example-com   cluster-pg-1                    Bound     db-worker-2        10Gi       RWO            local-storage   2d20h
example-com   cluster-pg-2                    Bound     db-worker-3        10Gi       RWO            local-storage   2d20h
example-com   cluster-pg-3                    Bound     db-worker-1        10Gi       RWO            local-storage   2d20h
example-com   data-loki-backend-0             Bound     db-worker-1-loki   10Gi       RWO            local-storage   9m42s
example-com   data-loki-backend-1             Bound     db-worker-3-loki   10Gi       RWO            local-storage   9m41s
example-com   data-loki-backend-2             Bound     db-worker-2-loki   10Gi       RWO            local-storage   9m41s
example-com   data-loki-write-0               Pending                                                local-storage   8m30s
example-com   data-loki-write-1               Pending                                                local-storage   8m26s
example-com   data-loki-write-2               Pending                                                local-storage   8m17s
example-com   export-0-grafana-loki-minio-0   Pending                                                                8m26s
example-com   export-1-grafana-loki-minio-0   Pending                                                                8m17s

The ones that are pending say that:

storageclass.storage.k8s.io "local-storage" not found

which seems weird, because there are working PVCs in the same namespace.

But when I try to list all storage classes:

$ kubectl get sc --all-namespaces
No resources found

How is this possible?


Solution

  • In kubernetes documentation Each StorageClass has a provisioner that determines what volume plugin is used for provisioning PVs. This field must be specified. local volumes could help you. Local volumes do not currently support dynamic provisioning, however a StorageClass should still be created to delay volume binding until Pod scheduling. This is specified by the WaitForFirstConsumer volume binding mode.

    Refer to this mount options and How to Use a Local Persistent Volume?.

    As you stated, all can understand the benefit of OpenESB Local PV, which supports dynamic PV provisioning.