CNCFKubernetesContainer OrchestrationIntermediate21 min read

What Does Storage Classes Mean?

Also known as: Storage Class, Kubernetes Storage Class, CKA storage class, dynamic provisioning, PersistentVolumeClaim

Reviewed byJohnson Ajibi· Senior Network & Security Engineer · MSc IT Security
On This Page

Quick Definition

A Storage Class is like a menu of storage options in Kubernetes. When an application needs storage, it can pick from this menu without knowing the exact details of how the storage works. The system then automatically creates the required storage based on the chosen option.

Must Know for Exams

Storage Classes are a core topic in the CNCF Certified Kubernetes Administrator (CKA) exam. The exam objectives explicitly include understanding and configuring storage classes, persistent volumes, persistent volume claims, and dynamic provisioning. This topic appears in the Storage section of the CKA curriculum, which typically accounts for 5-10% of the exam weight.

The CKA exam expects you to demonstrate hands-on ability with kubectl commands and YAML manifests. You might be asked to create a Storage Class from a YAML file, or to modify an existing one. You need to know how to specify the provisioner, set parameters, configure reclaim policies, and mark a Storage Class as default.

Questions often combine Storage Classes with other topics. For example, you might need to create a Pod that uses a PVC backed by a specific Storage Class. You might need to debug why a PVC is stuck in Pending state because the Storage Class provisioner is not installed. Understanding the relationship between StorageClass, PVC, and PV is essential.

The exam also tests your knowledge of volume binding modes. You need to know when to use WaitForFirstConsumer versus Immediate. A scenario could involve a multi-zone cluster where you need to ensure the PV is created in the same zone as the Pod. Selecting the correct binding mode is critical.

Another exam pattern involves default Storage Classes. You might be asked to ensure that a PVC without a storageClassName still gets provisioned correctly. That means you need to check if a default Storage Class exists and how to set one.

Finally, the CKA exam may test your understanding of reclaim policies. You might be asked what happens to the PV when the PVC is deleted, and you need to configure the Storage Class with the correct policy (Retain for backup purposes, Delete for ephemeral workloads).

Beyond CKA, Storage Classes are relevant to the Certified Kubernetes Application Developer (CKAD) exam, though at a more surface level. Application developers need to know how to reference a Storage Class in a PVC, but administrators need to create and manage them.

Simple Meaning

Think of a Storage Class as a set of pre-defined recipes for making storage in a Kubernetes cluster. Imagine you are running a busy hotel. Instead of having every guest call a different supplier for towels (which would be chaotic), the hotel has a standard process. When a guest asks for towels, the front desk just follows a simple recipe: call the linen service, order a dozen towels, and have them delivered to room 204. The guest does not care which truck delivers them or which factory made them. They just need towels that work.

In Kubernetes, a Storage Class is that recipe. It tells the system: when an application says it needs storage, here is exactly how to create it. The recipe includes what kind of storage to use (like fast SSD or regular hard drive), where to get it (which storage vendor), and how much to provision. The application just asks for storage; it does not need to know about SANs, iSCSI, or cloud volumes.

Kubernetes comes with a few built-in recipes, but administrators create custom ones for their specific environment. For example, if your company uses Amazon Web Services, you might create a Storage Class that always provisions gp3 EBS volumes. If you use on-premise NetApp storage, you create a Storage Class that talks to your NetApp array.

The real magic is in automatic provisioning. Without Storage Classes, an administrator would have to manually create a storage volume, then tell Kubernetes about it. With Storage Classes, the entire process is automated. When a Pod asks for storage via a PersistentVolumeClaim (PVC), Kubernetes looks at the Storage Class specified in the claim, follows the recipe, and creates the storage automatically. This is called dynamic provisioning.

Full Technical Definition

A Storage Class is a Kubernetes API resource that enables administrators to describe the classes of storage they offer. Different classes might map to quality of service levels, backup policies, or arbitrary policies determined by the cluster administrator. The Storage Class resource itself is defined in the storage.k8s.io API group.

Storage Classes are used in conjunction with PersistentVolumeClaims (PVCs) and PersistentVolumes (PVs). When a user creates a PVC and specifies a Storage Class name in the `storageClassName` field, Kubernetes invokes the provisioner associated with that Storage Class to create a new PV dynamically. This is known as dynamic provisioning. The provisioner is a controller that watches for PVC requests and responds by provisioning storage from a backend storage system.

Key technical components of a Storage Class include: the `provisioner` field which specifies the storage backend (e.g., `kubernetes.io/aws-ebs`, `kubernetes.io/gce-pd`, `nfs.csi.k8s.io`); the `parameters` field which provides key-value pairs specific to the provisioner (e.g., type, zone, replication factor); the `reclaimPolicy` field which controls what happens to the PV when its PVC is deleted (Retain, Delete, or Recycle); the `allowVolumeExpansion` field which enables resizing of volumes; and the `mountOptions` field which specifies mount options for the filesystem.

Storage Classes also support volume binding modes. The `WaitForFirstConsumer` mode delays binding and provisioning of a PV until a Pod that will use the PVC is scheduled. This helps ensure the PV is created in the same availability zone as the Pod. The `Immediate` mode creates the PV as soon as the PVC is created, without waiting for a Pod.

In real environments, Storage Classes are often integrated with Container Storage Interface (CSI) drivers. CSI is a standard for exposing arbitrary block and file storage systems to containerized workloads. Each CSI driver registers its own provisioner name. For example, the Amazon EBS CSI driver uses the provisioner `ebs.csi.aws.com`. Administrators create a Storage Class referencing that provisioner with specific parameters.

Storage Classes can also be set as the default for a cluster by adding the annotation `storageclass.kubernetes.io/is-default-class: true`. When a PVC is created without specifying a Storage Class, Kubernetes uses the default one. This is a common setup to simplify application deployments.

Exam Tip for CKA: You need to understand how to create a Storage Class manifest, how a PVC references a Storage Class, and how to configure dynamic provisioning. You should also know the difference between static provisioning (manually creating PVs) and dynamic provisioning (using Storage Classes).

Real-Life Example

Imagine a large public library with multiple reading rooms. The library has a central supply department that handles furniture requests. Each reading room has different needs. The children's room needs small, colorful tables. The quiet study room needs large wooden desks. The digital media lab needs tables with cable management and power outlets.

Instead of each room manager calling different furniture suppliers and negotiating prices, the library has a supply catalogue. The catalogue lists three options: Option A is a small plastic folding table, Option B is a standard wooden desk, and Option C is a media workstation with built-in power strips. Each option has a specific supplier and delivery method already set. When a room manager needs a new table, they just fill out a request form and specify the catalogue option.

In this analogy, the library supply catalogue is the Storage Class. The reading rooms are applications (Pods) that need storage. The furniture suppliers are the storage backends (like AWS EBS or NFS). The request form is the PersistentVolumeClaim. The delivery and setup are the dynamic provisioning process.

The mapping works as follows: a Storage Class named fast-ssd might provision an AWS gp3 volume. A Storage Class named slow-hdd might provision an AWS st1 volume. The application just says I need 50GB of storage using the fast-ssd option. Kubernetes handles everything else.

Another part of the analogy: the library also has a default supply option. If a room manager forgets to specify an option, the library automatically uses the standard wooden desk. In Kubernetes, if you mark a Storage Class as default, any PVC without a storageClassName will use that class by default.

Finally, the library might have a policy about old furniture. If a reading room is closed, the furniture might be returned to storage (Retain policy) or thrown away (Delete policy). Storage Classes have the same reclaim policy options for when volumes are no longer needed.

Why This Term Matters

Storage Classes matter because they solve a fundamental problem in containerized environments: how to provide persistent storage to ephemeral workloads. Containers are designed to be stateless and disposable, but many real applications like databases, content management systems, and logging platforms need to store data permanently. Without Storage Classes, managing storage in Kubernetes would be a manual, error-prone process.

In practical IT work, Storage Classes enable standardization. A DevOps engineer can define exactly three types of storage: standard HDD for logs, fast SSD for databases, and high-availability replicated storage for critical data. Developers then simply choose the right class for their application. This reduces variability and makes it easier to troubleshoot storage issues.

Storage Classes also enable cost optimization. By offering different performance tiers, organizations can match storage cost to workload requirements. A development environment might use cheaper, slower storage, while production databases use premium SSDs. The Storage Class abstraction means applications do not need to change code when moving between environments.

For cloud infrastructure teams, Storage Classes simplify multi-cloud operations. You can have a Storage Class that works with AWS, one for Azure, and one for on-premise storage. The Kubernetes API remains consistent across all environments. This portability is a major advantage for hybrid cloud strategies.

Storage Classes also play a critical role in disaster recovery and backup strategies. You can create Storage Classes that automatically snapshot volumes or replicate data to another region. When integrated with CSI drivers, Storage Classes can trigger backup policies at the storage backend level.

Finally, Storage Classes are essential for compliance and governance. An administrator can enforce that production workloads always use encrypted storage by creating a Storage Class that provisions encrypted volumes. Developers cannot bypass this because they must use the Storage Class defined for production.

How It Appears in Exam Questions

In certification exams, Storage Classes appear in several distinct question formats. The most common is the configuration question. For example: Create a Storage Class named fast-storage using the provisioner kubernetes.io/aws-ebs. Set the type parameter to gp3 and the reclaimPolicy to Delete. This tests your ability to write a valid YAML manifest.

Another common format is the troubleshooting scenario. A PVC is stuck in Pending state. The question provides the PVC YAML and the list of Storage Classes. You must identify that the PVC references a Storage Class that does not exist, or that the provisioner is not deployed. You then fix it by creating the missing Storage Class or adjusting the PVC reference.

Scenario-based questions are also common. You are given a Kubernetes cluster with three Storage Classes: ssd, hdd, and premium. A developer creates a PVC for a MySQL database that needs fast storage. Which Storage Class should the PVC use? Answer: ssd or premium. This tests your understanding of matching workload requirements to storage characteristics.

Architecture questions appear as well. You might be asked: What happens when a Pod using a PVC with WaitForFirstConsumer binding mode is created in a cluster with nodes in three zones? The correct answer involves the PV being provisioned only after the Pod is scheduled, and in the same zone as the Pod. This tests your deeper understanding of the provisioning lifecycle.

Exam questions also test default Storage Class knowledge. A PVC is created without a storageClassName. There is no default Storage Class. What happens? The PVC remains Pending because no Storage Class is identified. You need to either set a default or specify a class. This type of question catches candidates who assume automatic behavior.

Another pattern involves reclaim policies. A Storage Class has reclaimPolicy: Retain. A PVC using it is deleted. What happens to the PV? The PV remains in the Released state, available for manual reclaim. This contrasts with Delete, where the PV and underlying storage are removed.

Finally, multi-part questions may chain these concepts. You might create a Storage Class, then a PVC referencing it, then a Pod using the PVC, and then verify the volume is mounted. These questions test your end-to-end understanding of dynamic provisioning.

Study cncf-cka

Test your understanding with exam-style practice questions.

Practise

Example Scenario

Scenario: Your company runs a video processing platform on Kubernetes. Videos are uploaded by users, processed by worker Pods, and the results are stored permanently. The team uses two types of storage: standard HDD for temporary work files and fast SSD for final processed videos.

You are the cluster administrator. You decide to create two Storage Classes to automate storage provisioning. The first Storage Class is named temp-storage. Its recipe uses a slower, cheaper backend with reclaimPolicy set to Delete because temporary files should be removed when no longer needed. The second Storage Class is named final-storage. It uses a fast SSD backend with reclaimPolicy set to Retain because processed videos are valuable and must be preserved even if the PVC is deleted.

A developer creates two PVCs: one for the worker Pod using temp-storage and one for the output Pod using final-storage. When the worker Pod starts, Kubernetes sees the temp-storage PVC, finds the matching Storage Class, and automatically provisions a 100GB HDD volume. When the output Pod starts, the final-storage PVC causes a 500GB SSD volume to be provisioned.

Later, the worker Pod is deleted. Its PVC is also deleted, and because the Storage Class has reclaimPolicy: Delete, the underlying HDD volume is destroyed. No manual cleanup needed. However, the final-storage PVC is kept, and even if it is eventually deleted, the SSD volume remains in the storage backend because of the Retain policy, allowing data recovery if needed.

Common Mistakes

Confusing Storage Classes with PersistentVolumeClaims (PVCs).

A Storage Class is a template or recipe, while a PVC is a request for storage. The PVC references the Storage Class, but they are separate API resources. Thinking they are the same prevents understanding how dynamic provisioning works.

Remember: Storage Class defines how to provision storage. PVC is the request that triggers provisioning. You create a Storage Class once, then create many PVCs that reference it.

Forgetting to specify the provisioner field in the Storage Class.

Without a provisioner, Kubernetes does not know which backend to call to create the storage. The Storage Class is essentially incomplete and cannot be used for dynamic provisioning. PVCs referencing it will remain in Pending state.

Always include the provisioner field. For cloud environments, use the appropriate provisioner for your CSI driver or in-tree plugin, such as kubernetes.io/aws-ebs or ebs.csi.aws.com.

Assuming all Storage Classes support volume expansion.

Volume expansion requires the allowVolumeExpansion field set to true and support from the underlying storage backend. Not all provisioners or backends support it. Failing to check this leads to errors when resizing PVCs.

Check the CSI driver documentation for volume expansion support. Set allowVolumeExpansion: true only if the backend supports it and the feature gate is enabled.

Setting reclaimPolicy: Retain and expecting automatic cleanup.

Retain means the PV and its underlying storage are kept after PVC deletion. The PV enters a Released state, but the storage still incurs costs. Administrators must manually delete the PV and clean up storage. Expecting automatic cleanup wastes resources.

Use Retain only when you intentionally want to keep data for backup or recovery. For normal workloads, use Delete to automatically remove storage when the PVC is deleted.

Creating a PVC without a storageClassName when no default Storage Class exists.

If no Storage Class has the annotation storageclass.kubernetes.io/is-default-class: true, a PVC without a storageClassName will not match any Storage Class. The PVC will stay Pending indefinitely, causing application failures.

Either set a default Storage Class by adding the annotation to an existing class, or explicitly specify storageClassName in every PVC. Check for existing defaults with kubectl get sc.

Using Immediate binding mode in multi-zone clusters without understanding the implications.

Immediate binding creates the PV as soon as the PVC is created, regardless of Pod placement. This can result in the PV being in a different zone than the Pod, causing scheduling failures or latency issues.

For multi-zone clusters, use WaitForFirstConsumer binding mode. This delays PV creation until the Pod is scheduled, ensuring zone alignment.

Exam Trap — Don't Get Fooled

A question asks you to modify an existing PVC to use a different Storage Class. You edit the PVC's storageClassName field and apply the change. Remember that the storageClassName field in a PVC is immutable after creation.

It cannot be changed. To use a different Storage Class, you must delete the existing PVC and create a new one with the correct storageClassName. If the application cannot tolerate downtime, create the new PVC first, migrate data, then switch the application to use the new PVC.

Commonly Confused With

Storage ClassesvsPersistentVolume (PV)

A PersistentVolume is an actual storage resource that has been provisioned, either statically by an administrator or dynamically via a Storage Class. A Storage Class is just the definition or template for how to create PVs. You create a Storage Class once, and it can be used to create many PVs automatically.

A Storage Class is like a recipe for baking a cake. The PersistentVolume is the actual cake that gets baked. You keep the recipe (Storage Class) and use it to bake many cakes (PVs).

Storage ClassesvsPersistentVolumeClaim (PVC)

A PersistentVolumeClaim is a request by a user for storage. It specifies size, access modes, and optionally a Storage Class. The Storage Class is the mechanism that fulfills that request by provisioning a matching PV. The PVC is the request; the Storage Class is the provisioning method.

A PVC is like ordering a pizza with specific toppings. The Storage Class is the pizza shop's recipe for making that pizza. The PV is the pizza you actually receive.

Storage ClassesvsVolumeSnapShotClass

A VolumeSnapshotClass is similar to a Storage Class but for snapshots instead of volumes. It defines how snapshots are provisioned by a CSI driver. Storage Classes handle live volume provisioning; VolumeSnapshotClasses handle point-in-time copies of those volumes.

A Storage Class is the recipe for creating a database volume. A VolumeSnapshotClass is the recipe for creating a backup copy of that database volume.

Storage ClassesvsConfigMap

A ConfigMap stores configuration data like environment variables or small files. It is not used for persistent storage of application data. Storage Classes are about block or file storage for stateful applications. ConfigMaps are just key-value pairs or small text files.

A ConfigMap stores the settings for a web app, like database connection strings. A Storage Class provides the actual disk space where the web app saves user uploads.

Step-by-Step Breakdown

1

Administrator defines Storage Class

The cluster administrator creates a Storage Class YAML manifest. This defines the provisioner (e.g., ebs.csi.aws.com), parameters like volume type or IOPS, reclaim policy, and binding mode. This is a one-time setup per storage type.

2

Developer creates PersistentVolumeClaim (PVC)

A developer or application creates a PVC manifest requesting storage. The PVC specifies storage size, access modes (ReadWriteOnce, ReadOnlyMany, ReadWriteMany), and the storageClassName matching the desired Storage Class.

3

Kubernetes matches PVC to Storage Class

Kubernetes sees the PVC with a storageClassName. It looks up the corresponding Storage Class object in the cluster. If the class exists and is valid, Kubernetes proceeds to dynamic provisioning.

4

Provisioner creates PersistentVolume (PV)

Kubernetes calls the provisioner specified in the Storage Class. The provisioner creates the actual storage resource (e.g., an EBS volume in AWS). It then creates a PV object representing that storage in the cluster. The PV is bound to the PVC.

5

Pod uses the bound PVC

A Pod is created referencing the PVC in its volumes section. The Pod is scheduled to a node. If WaitForFirstConsumer binding is used, this step might have happened before PV creation. The PV is then mounted into the Pod's filesystem at the specified mount path.

6

Cleanup based on reclaim policy

When the PVC is deleted, the reclaim policy on the Storage Class determines what happens. Delete removes both the PV and the underlying storage. Retain keeps the PV (in Released state) and the storage for manual recovery.

Practical Mini-Lesson

Storage Classes are one of the most powerful abstractions in Kubernetes for managing persistent storage. They allow you to separate the concerns of storage provisioning from application logic. As an administrator or developer, understanding Storage Classes is essential for running stateful workloads effectively.

To create a Storage Class, you write a YAML file with the apiVersion storage.k8s.io/v1, kind StorageClass, and metadata name. The critical field is provisioner. For example, in an AWS environment using the EBS CSI driver, you would use provisioner: ebs.csi.aws.com. The parameters section is where you configure storage characteristics. For EBS, common parameters include type (gp3, io2, st1), iopsPerGB, and encrypted. For NFS, parameters might include server and share.

Here is a practical example. Suppose you want to create a Storage Class for high-performance MySQL databases. You might define: provisioner: ebs.csi.aws.com parameters: type: gp3 iops: 3000 throughput: 125 encrypted: 'true' reclaimPolicy: Retain allowVolumeExpansion: true volumeBindingMode: WaitForFirstConsumer

This ensures that every MySQL Pod gets an encrypted, high-performance SSD volume in the same availability zone, and the volume is retained after PVC deletion for backup purposes.

What can go wrong? The most common issue is that the CSI driver is not installed. Creating a Storage Class is futile if the provisioner pod is not running. Always verify CSI driver deployment with kubectl get pods -n kube-system. Another issue is mismatched parameters. If you request IOPS that exceed volume limits, provisioning fails silently.

For exam preparation, practice writing Storage Class YAML from scratch. Know how to check default Storage Classes. Understand how to troubleshoot stuck PVCs. The command kubectl describe pvc will show events explaining why provisioning failed.

Storage Classes connect to broader concepts like CSI, dynamic provisioning, and persistent storage. They are part of the Kubernetes storage ecosystem alongside PVs, PVCs, and VolumeSnapshots. Mastering Storage Classes gives you control over how applications consume storage in a consistent, automated way.

Memory Tip

Think of Storage Class as a pizza recipe: the cookbook (recipe) is the Storage Class, the order form is the PVC, and the actual pizza is the PV. The recipe must exist before you can order pizza.

Covered in These Exams

Related Glossary Terms

Frequently Asked Questions

Can I change the Storage Class of an existing PVC?

No, the storageClassName field is immutable after creation. To use a different Storage Class, you must delete the existing PVC and create a new one with the correct class. Plan for potential data migration.

What happens if I create a PVC without a storageClassName and no default Storage Class exists?

The PVC will remain in Pending state because Kubernetes cannot match it to any Storage Class. You must either set a default Storage Class by adding the annotation storageclass.kubernetes.io/is-default-class: true, or specify a storageClassName in the PVC.

Can I have multiple default Storage Classes in one cluster?

No, having more than one default Storage Class causes an error. Kubernetes will reject PVCs without a storageClassName if multiple defaults exist. Only one Storage Class should have the default annotation.

What is the difference between a Storage Class and a CSI driver?

A CSI driver is software that translates Kubernetes requests into storage backend operations. The Storage Class is a configuration object that references a specific CSI driver and provides parameters for provisioning. You need both: the driver installed, and a Storage Class that uses it.

Do I need Storage Classes for static provisioning?

No, static provisioning means an administrator manually creates PVs. Storage Classes are used for dynamic provisioning, where volumes are created automatically on demand. You can use PVs without any Storage Class.

How do I check which Storage Classes exist in my cluster?

Use the command kubectl get sc or kubectl get storageclass. This lists all Storage Classes with details like provisioner and reclaim policy. The default class is marked with (default).

What does volumeBindingMode WaitForFirstConsumer mean?

It means the PV is not created until a Pod using the PVC is scheduled to a node. This ensures the PV is provisioned in the same availability zone as the Pod, avoiding cross-zone latency or scheduling failures.

Summary

Storage Classes are a foundational concept in Kubernetes storage management, enabling automated, policy-driven provisioning of persistent volumes. They act as templates that define which storage backend to use, what performance characteristics to apply, and how to handle volume lifecycle. By abstracting the details of storage provisioning, Storage Classes allow developers to request storage by name without needing to understand underlying infrastructure.

For CKA exam candidates, mastering Storage Classes is essential because they appear in configuration tasks, troubleshooting scenarios, and architecture questions. Key points to remember: a Storage Class is not a volume itself but a recipe for creating volumes; the provisioner field is mandatory; reclaim policy controls cleanup behavior; volume binding mode affects zone placement; and immutability of PVC storageClassName requires careful planning. Understanding Storage Classes equips you to manage stateful applications in Kubernetes with confidence and efficiency.