StorageClass
What is StorageClass?
StorageClass: A template for dynamically provisioning PVs. Defines the provisioner (e.g. an EBS or GCE PD driver) and parameters like disk type. A StorageClass in Kubernetes describes a type of storage that can be created on demand. It names the provisioner, such as the cloud provider's disk driver, and settings like disk type, speed and reclaim policy.
Frequently asked questions about StorageClass
How is StorageClass used in practice?
When a PersistentVolumeClaim asks for storage of a certain class, Kubernetes creates a matching volume automatically. Managed clusters come with a default class, so claims without a class still get a disk.
What should you keep in mind with StorageClass?
Check the default's reclaim policy. With Delete, removing a claim also deletes the disk and its data; Retain keeps the disk for manual cleanup. Use faster SSD classes for databases and cheaper ones for bulk data. Enable allowVolumeExpansion if the provider supports it, so you can grow volumes later without recreating them.
What does an example of StorageClass look like?
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: fast-ssd provisioner: ebs.csi.aws.com parameters: type: gp3 At a glance
| Category | Kubernetes |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |