Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 66/ 160
04. Storage & Persistent Data

StorageClasses & Dynamic Volume Provisioning

Request storage by class so provisioners create volumes on demand.

BeginnerStorageClass · Dynamic Provisioning · Parameters3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

A StorageClass is the storage vending machine catalog; the PVC selects a machine size and the Pod's location controls which cabinet can serve it. The simple Kubernetes rule is: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.

Think of it like…

A StorageClass is the storage vending machine catalog; the PVC selects a machine size and the Pod's location controls which cabinet can serve it.

Where you’ve seen it

Before approving a data-path change, the storage owner runs kubectl get storageclass; kubectl get pvc checkout-data -o yaml. Expected evidence: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it. If the run instead shows this symptom, stop and restore the last known state: VolumeBindingMode WaitForFirstConsumer is required to avoid provisioning in the wrong zone, and a nonexistent default or driver leaves the claim Pending.

Words you’ll hear

StorageClass
For this lesson, StorageClass is the controlling idea: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.
Dynamic Provisioning
Dynamic Provisioning is the checkpoint; run kubectl get storageclass; kubectl get pvc checkout-data -o yaml and inspect the owner chain. VolumeBindingMode WaitForFirstConsumer is required to avoid provisioning in the wrong zone, and a nonexistent default or driver leaves the claim Pending.
Parameters
Parameters is the outcome to preserve; the cost is explicit: Dynamic provisioning removes preallocation work, but class explosion, cloud quotas, encryption parameters, and deletion policy become platform contracts.
Verification evidence
The evidence command is kubectl get storageclass; kubectl get pvc checkout-data -o yaml. It connects the declaration to this behavior: Request storage by class so provisioners create volumes on demand.

Visual diagram

Loading interactive diagram

Theory & deep dive

How StorageClass reaches the intended state

Request storage by class so provisioners create volumes on demand. A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.

The concrete checkpoint is kubectl get storageclass; kubectl get pvc checkout-data -o yaml; compare the StorageClass owner, Dynamic Provisioning state, and Parameters outcome instead of treating YAML acceptance as proof.

Verify Dynamic Provisioning, not only object creation

Run kubectl get storageclass; kubectl get pvc checkout-data -o yaml after the change and correlate the result with Events and the owning object. A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.

Key takeaway: StorageClass is implemented only when this invariant remains observable: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.

Dynamic Provisioning: failure boundary and production cost

VolumeBindingMode WaitForFirstConsumer is required to avoid provisioning in the wrong zone, and a nonexistent default or driver leaves the claim Pending. The prerequisite contract is concrete: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.

Dynamic provisioning removes preallocation work, but class explosion, cloud quotas, encryption parameters, and deletion policy become platform contracts. A safe design limits blast radius, records the last good configuration, and uses kubectl get storageclass; kubectl get pvc checkout-data -o yaml as a deterministic rollback checkpoint.

Recover from Dynamic Provisioning drift

Capture the current state with kubectl get storageclass; kubectl get pvc checkout-data -o yaml, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: VolumeBindingMode WaitForFirstConsumer is required to avoid provisioning in the wrong zone, and a nonexistent default or driver leaves the claim Pending.

Key takeaway: Accept the trade-off consciously: Dynamic provisioning removes preallocation work, but class explosion, cloud quotas, encryption parameters, and deletion policy become platform contracts.

How it works, step by step

Step 1 of 4
Data owner

1. Declare the data contract

State capacity, topology, access, and ownership in the claim or class: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.

StorageClass contract → owned state
Key numbers at this step
Goal
Request storage by class so provisioners create volumes on demand.
Owner
StorageClass

When to use it & trade-offs

What it is

Request storage by class so provisioners create volumes on demand. A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.

Why it matters: VolumeBindingMode WaitForFirstConsumer is required to avoid provisioning in the wrong zone, and a nonexistent default or driver leaves the claim Pending. The invariant at risk is specific: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it. The quickest fact check before changing the design is kubectl get storageclass; kubectl get pvc checkout-data -o yaml.

When to reach for it

  • Use StorageClass to enforce this invariant: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.
  • Use Dynamic Provisioning evidence from kubectl get storageclass; kubectl get pvc checkout-data -o yaml in reviews and incident timelines. Request storage by class so provisioners create volumes on demand.
  • Choose the managed external data plane route only when this cost is justified by governance or scale: Dynamic provisioning removes preallocation work, but class explosion, cloud quotas, encryption parameters, and deletion policy become platform contracts.

When to avoid or be careful

  • Avoid assuming StorageClass is complete after YAML submission; the required behavior is concrete: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.
  • Avoid treating the next symptom as random; check the owner and state with kubectl get storageclass; kubectl get pvc checkout-data -o yaml first: VolumeBindingMode WaitForFirstConsumer is required to avoid provisioning in the wrong zone, and a nonexistent default or driver leaves the claim Pending.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Dynamic provisioning removes preallocation work, but class explosion, cloud quotas, encryption parameters, and deletion policy become platform contracts.

Native, manual, and managed paths for StorageClass

Dynamically provisioned storage
Best for: Request storage by class so provisioners create volumes on demand. A concrete incident check is kubectl get storageclass; kubectl get pvc checkout-data -o yaml.

Strengths: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.

Watch out: Dynamic provisioning removes preallocation work, but class explosion, cloud quotas, encryption parameters, and deletion policy become platform contracts. Recovery must also recognize this signal: VolumeBindingMode WaitForFirstConsumer is required to avoid provisioning in the wrong zone, and a nonexistent default or driver leaves the claim Pending.

Manual pre-provisioning
Best for: Quickly testing the Dynamic Provisioning assumption with kubectl get storageclass; kubectl get pvc checkout-data -o yaml; the expected invariant is: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.

Strengths: kubectl get storageclass; kubectl get pvc checkout-data -o yaml gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike StorageClass, it does not make this symptom self-documenting: VolumeBindingMode WaitForFirstConsumer is required to avoid provisioning in the wrong zone, and a nonexistent default or driver leaves the claim Pending.

Managed external data plane
Best for: Teams that need Parameters integrated with guardrails; the evidence path is kubectl get storageclass; kubectl get pvc checkout-data -o yaml.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.

Watch out: The added platform ownership buys value at this cost: Dynamic provisioning removes preallocation work, but class explosion, cloud quotas, encryption parameters, and deletion policy become platform contracts.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.
  • Trace StorageClass to Parameters through Dynamic Provisioning; the invariant is: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.
  • Recognize the symptom: VolumeBindingMode WaitForFirstConsumer is required to avoid provisioning in the wrong zone, and a nonexistent default or driver leaves the claim Pending.
  • Justify the cost: Dynamic provisioning removes preallocation work, but class explosion, cloud quotas, encryption parameters, and deletion policy become platform contracts.
  • Verify with kubectl get storageclass; kubectl get pvc checkout-data -o yaml instead of only inspecting YAML.

Benchmarks & rules of thumb

1 -
default class applies only when no class is named and defaulting runs
2 -
binding modes: Immediate and WaitForFirstConsumer
0 -
CSI volume cost is eliminated by dynamic provisioning

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the StorageClass owner contract: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it.
  • Ignoring this telltale condition leads to unrelated changes: VolumeBindingMode WaitForFirstConsumer is required to avoid provisioning in the wrong zone, and a nonexistent default or driver leaves the claim Pending.
  • Repeating kubectl get storageclass; kubectl get pvc checkout-data -o yaml without an owner for remediation wastes retry cost. Dynamic provisioning removes preallocation work, but class explosion, cloud quotas, encryption parameters, and deletion policy become platform contracts.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it?
  • Which owner object, logs, and Events would you inspect for this symptom-VolumeBindingMode WaitForFirstConsumer is required to avoid provisioning in the wrong zone, and a nonexistent default or driver leaves the claim Pending-?
  • At what threshold would this cost become unacceptable: Dynamic provisioning removes preallocation work, but class explosion, cloud quotas, encryption parameters, and deletion policy become platform contracts?
Interview tip: Interview sequence: state the invariant, run kubectl get storageclass; kubectl get pvc checkout-data -o yaml, name the failure, then justify the cost. Invariant: A StorageClass chooses a provisioner plus immutable class parameters, and a PVC triggers volume creation when dynamic provisioning and an available topology allow it. Failure: VolumeBindingMode WaitForFirstConsumer is required to avoid provisioning in the wrong zone, and a nonexistent default or driver leaves the claim Pending. Cost: Dynamic provisioning removes preallocation work, but class explosion, cloud quotas, encryption parameters, and deletion policy become platform contracts.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply StorageClasses & Dynamic Volume Provisioning with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Reclaim Policies (Retain, Delete, Recycle)
Next topic
Container Storage Interface (CSI) Architecture & Drivers