⚡ ~/naveed k8s
⚡ Portfolio Home ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
Phase 1 — Fundamentals Module 05 of 24 Free & Open Access

Storage: Volumes, PV, PVC, StorageClasses

Complete production curriculum breakdown. Learn core architectural mechanics, study definitions in plain language, practice hands-on labs with the local minikube prod-sim cluster, and test active recall.

05 - Storage: Volumes, PV, PVC, StorageClasses

Why this matters

Stateful workloads (databases, queues, anything that can't lose data on restart) need storage that outlives the pod. This is one of the trickiest areas to get right in prod.

Read this first — Definitions & Explanations

Volume (generic)

A directory accessible to containers in a Pod. Can be ephemeral (emptyDir) or backed by real storage.

PersistentVolume (PV)

A piece of storage in the cluster provisioned by an admin or dynamically. Cluster-scoped resource representing disk/NFS/cloud volume capacity and access modes.

PersistentVolumeClaim (PVC)

A user/app request for storage (“I need 10Gi ReadWriteOnce”). The control plane binds PVC → PV.

StorageClass

Defines how dynamic volumes are created (provisioner, reclaim policy, parameters). When a PVC asks for a StorageClass, a PV can be auto-provisioned.

Access modes

Reclaim policy

What happens to a PV when PVC is deleted: Retain, Delete, or older Recycle. Know this before deleting claims in production.

Dynamic vs static provisioning

Official docs (read for detail)

Key Concepts

YouTube search terms

Hands-on lab (on prod-sim)

kubectl get storageclass    # minikube ships a default "standard" class

# Dynamic provisioning via PVC
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: test-pvc
spec:
  accessModes: ["ReadWriteOnce"]
  resources:
    requests:
      storage: 1Gi
EOF
kubectl get pvc test-pvc
kubectl get pv    # see the PV that got auto-created

# Mount it in a pod, write data, delete pod, remount, prove data persists
kubectl run writer --image=busybox --restart=Never --overrides='
{"spec":{"volumes":[{"name":"data","persistentVolumeClaim":{"claimName":"test-pvc"}}],
"containers":[{"name":"writer","image":"busybox","command":["sh","-c","echo hello > /data/file.txt; sleep 3600"],
"volumeMounts":[{"name":"data","mountPath":"/data"}]}]}}'
kubectl exec writer -- cat /data/file.txt
kubectl delete pod writer --wait
kubectl run reader --image=busybox --restart=Never --overrides='
{"spec":{"volumes":[{"name":"data","persistentVolumeClaim":{"claimName":"test-pvc"}}],
"containers":[{"name":"reader","image":"busybox","command":["cat","/data/file.txt"],
"volumeMounts":[{"name":"data","mountPath":"/data"}]}]}}'
kubectl logs reader   # should print "hello" — proves data outlived the pod

# StatefulSet with per-replica storage
kubectl apply -f https://k8s.io/examples/application/web/web.yaml
kubectl get pvc -l app=nginx   # one PVC per replica: www-web-0, www-web-1, www-web-2

Notes

(fill in your own words after watching + labbing)

📋 Self-Assessment Mastery Checklist (4 Competencies)
🧠 Practice Exam Questions (Module 05 MCQs)
⚡ Take Quiz & Save Progress in Tracker

Review these sample exam questions out loud, test your retrieval, and then unlock official scoring in the interactive tracker.

Question 1: A PersistentVolumeClaim (PVC) is:
  • A. A node disk partition
  • B. A request for storage by a user/Pod
  • C. A CNI plugin
  • D. An Ingress rule
✓ Correct Answer: B (A request for storage by a user/Pod)
Option B ('A request for storage by a user/Pod') is the standard production architectural best practice.
Question 2: StorageClass typically controls:
  • A. How dynamic volumes are provisioned
  • B. Pod CPU limits only
  • C. Service DNS names
  • D. RBAC roles
✓ Correct Answer: A (How dynamic volumes are provisioned)
Option A ('How dynamic volumes are provisioned') is the standard production architectural best practice.
Question 3: AccessModes like ReadWriteOnce mean:
  • A. How many Pods can mount the volume and how
  • B. Network policy rules
  • C. API rate limits
  • D. Scheduler priority
✓ Correct Answer: A (How many Pods can mount the volume and how)
Option A ('How many Pods can mount the volume and how') is the standard production architectural best practice.
Question 4: A PersistentVolume (PV) represents:
  • A. Cluster-wide storage resource
  • B. A single container filesystem layer
  • C. A ConfigMap
  • D. A Service VIP
✓ Correct Answer: A (Cluster-wide storage resource)
Option A ('Cluster-wide storage resource') is the standard production architectural best practice.
Question 5: Dynamic provisioning creates a PV when:
  • A. You create a PVC that matches a StorageClass
  • B. You restart kubelet
  • C. You apply a Service
  • D. You create a Namespace
✓ Correct Answer: A (You create a PVC that matches a StorageClass)
Option A ('You create a PVC that matches a StorageClass') is the standard production architectural best practice.
← Previous Module (04) ConfigMaps & Secrets Next Module (06) → Scheduling: Affinity, Taints, Resources, PDBs