A StorageClass is a profile for a class of Kubernetes storage, such as local or cloud storage. It lets an application request persistent storage through a PersistentVolumeClaim (PVC) without an administrator first creating a matching PersistentVolume (PV). The class groups similar storage; its name does not change the underlying storage’s capabilities. section 7.3 section 7.5
To use an existing class:
- Run `kubectl get sc` to find its name and check its provisioner, reclaim policy, and volume binding mode. Do not assume every cluster has the same precreated class. section 7.3
- Create a PVC with `storageClassName` set to that class and the requested capacity. Apply the PVC with `kubectl apply -f newpvc.yaml`; you do not need to create its PV separately. section 7.3 section 7.5
- Mount the claim in a pod or Deployment, then run `kubectl get pvc,pv` to verify that the claim is Bound and a PV exists. section 7.3
Request storage for a Deployment
An exam-style task requests a 1 GiB PVC named `claim-03833` from the existing `standard` class, then mounts it in a Deployment container at `/var/lib/mysql`. If `kubectl get pvc` initially shows Pending, check the class’s binding mode before treating it as a failure. With `WaitForFirstConsumer`, the volume waits until a pod uses the claim. After creating the consumer, check `kubectl get pvc,pv` for the Bound claim and automatically provisioned 1 GiB PV. section 7.3
root@kind-control-plane:/# kubectl get sc standard -o yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
annotations:
storageclass.kubernetes.io/is-default-class: "true"
creationTimestamp: "2025-07-14T21:10:24Z"
name: standard
resourceVersion: "264"
uid: 6caa1035-1584-4356-a060-90c923293a3b
provisioner: rancher.io/local-path
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
Inspect the `standard` class with `kubectl get sc standard -o yaml`. Its provisioner, `Delete` reclaim policy, and `WaitForFirstConsumer` binding mode show settings applied to automatically provisioned PVs. section 7.3.1
For practice, create a `node-local` StorageClass using `kubernetes.io/no-provisioner` and `WaitForFirstConsumer`, then create a `ReadWriteOnce` PVC and a pod that mounts it. Keep this exercise distinct from using an existing class to dynamically provision a PV: the specified provisioner is `no-provisioner`. section 7.3.1



