2 Answers
with PV you have to have provisioned the storage on your storage provider, but SC dynamically provisions that for you
StorageClass is just a higher level of abstraction over PersistentVolumes (PV).
Think of them as a plugin to the cloud-provided storage (either aws s3/ebs, gcp gcs/pd). You put in the parameters of the StorageClass, then just reference the storageClassName
in PersisentVolumeClaim
and PersistentVolume
.
In term, say whenever a Pod is deployed .. it will trigger a PV which in turn talks to the StorageClass
.
The StorageClass
has a provisioner
type, which essentially points to the volume plugin. So something more concrete:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: fast
provisioner: kubernetes.io/aws-ebs
parameters:
type: io1
zones: us-west-1
iopsPerGB: "10"
https://kubernetes.io/docs/concepts/storage/storage-classes/