Storage Orchestration in Kubernetes: From Theory to Hands-On Demo
DevOps engineer & developer passionate about building scalable, reliable systems. I design and automate pipelines, manage cloud infrastructure, and ensure deployments run smoothly. Turning complex workflows into seamless operations is my craft.
“Stateless is easy. Stateful? That's where Kubernetes storage orchestration flexes its muscle.” — Everyone who's deployed a DB on K8s.
Short Story: The Pod That Lost Its Memory
In a bustling Kubernetes cluster, there was a little pod named Poddy.
Poddy worked hard—serving users, processing requests, and writing logs. But every time it restarted, it forgot everything.
💬 “Where did my data go?” Poddy cried.
The wise Kube Master replied,
“You need to talk to PVC, the keeper of persistence.”
With the help of PVC and a friendly PersistentVolume, Poddy found a safe space to store its data — even if it vanished and respawned.
From then on, no matter how many times Poddy restarted, its memory lived on… in storage orchestrated by Kubernetes.
The end.
What is Storage Orchestration?
In Kubernetes, your apps run inside containers. These containers usually lose all data when they shut down. That’s fine for simple apps — but what about:
E-commerce apps storing product images?
Analytics tools saving logs or reports?
Databases storing critical data?
You need persistent storage. Kubernetes handles this via Storage Orchestration — it automatically provisions, attaches, mounts, and manages storage for your apps.
Key Concepts (Explained Simply)
1. Volume
A volume in Kubernetes is like a folder that a container can read and write to. But it’s not persistent by default.
If your app restarts, data inside a normal volume is gone.
2. PersistentVolume (PV)
A PersistentVolume is a real piece of storage — like a disk or a folder on a server. You (or the system) create this ahead of time.
3. PersistentVolumeClaim (PVC)
A PVC is like an app saying:
“Hey Kubernetes, I need 1 GB of space to store files.”
Kubernetes looks for a matching PV, or it can create one dynamically (more on that soon).
4. StorageClass
This tells Kubernetes how to create PVs — e.g., using SSD, HDD, fast, slow, encrypted, or replicated storage.
5. CSI (Container Storage Interface)
A standard plugin system. Cloud providers like AWS, Azure, GCP, and others implement CSI drivers so Kubernetes can interact with their storage systems.
Storage Flow Diagram
PVC --> StorageClass --> Dynamic PV --> Mounted to Pod
Hands-On Demo: Storage in Action (Minikube)
Prerequisites: Minikube + kubectl installed on your machine
Step 1: Start Minikube
minikube start
Step 2: Create a StorageClass (we’ll use hostPath here for local demo)
# storageclass-hostpath.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
kubectl apply -f storageclass-hostpath.yaml
✅ Step 3: Create a PersistentVolume (PV)
# pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: local-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: local-storage
hostPath:
path: "/mnt/data"
kubectl apply -f pv.yaml
✅ Step 4: Create a PersistentVolumeClaim (PVC)
# pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: demo-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi
storageClassName: local-storage
kubectl apply -f pvc.yaml
✅ Step 5: Create a Pod to Use the PVC
# pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: pvc-demo-pod
spec:
containers:
- name: app
image: busybox
command: ["sleep", "3600"]
volumeMounts:
- mountPath: "/data"
name: storage
volumes:
- name: storage
persistentVolumeClaim:
claimName: demo-pvc
kubectl apply -f pod.yaml
Step 6: Test the Volume
kubectl exec -it pvc-demo-pod -- sh
Inside the pod:
echo "Hello from K8s storage" > /data/hello.txt
cat /data/hello.txt
You’ve successfully written to persistent storage inside your pod!
Access Modes Quick Guide
| Access Mode | Description | Cloud Support |
ReadWriteOnce | One node can read/write | ✅ All |
ReadOnlyMany | Many nodes can read | ❌ Limited |
ReadWriteMany | Many nodes can read/write | ✅ With NFS, Ceph |
Final Thoughts
Storage orchestration in Kubernetes might seem daunting at first, but it’s one of the most powerful features once you grasp the flow:
Pods are ephemeral, but your data doesn't have to be.
Whether you’re:
Mounting a shared volume for a frontend,
Creating durable storage for a database,
Or scaling a stateful app with confidence...
Kubernetes has all the tools to make your storage reliable, repeatable, and resilient.
✅ Learn the roles of PV, PVC, StorageClass, and StatefulSet.
✅ Practice with real YAML examples.
✅ And most importantly — test what happens when things fail and restart.
Because that’s when storage orchestration truly shines.