Skip to content
EgyKode
06 · KubernetesLab 34 / 59
Guided labkubernetesDestructive

Kubernetes Storage: PVC, PV and StorageClass

Prove a container's filesystem is disposable, then attach storage that survives, and meet the access mode that blocks a rollout.

Time
50 min
Level
Intermediate
Objectives
4 objectives
Cost
Free

Where this fits in the platform

This lab adds

  • A volume that outlives the pod using it

Before you start

You will need

  • kind or minikube
  • kubectl 1.28+

You do not need these already — the lab environment below provides them.

You will be able to

  • Explain the StorageClass → PV → PVC chain and who creates what
  • Recognise why ReadWriteOnce blocks a multi-replica Deployment
  • Know what `reclaimPolicy` does to your data

CostFree

on kind or minikube. On a cloud cluster each PVC provisions a real disk billed per GB-month — see cleanup.

Nothing to pay in the browser. Open the terminal runs this against a simulated cloud — the same API calls and the same commands, with no account and no bill. The figure above applies only if you build it in your own.

How to clean up

The scenario#

A container's filesystem dies with the container. Most workloads do not care; a database very much does.

This lab shows the difference concretely, then walks into the access mode that stops a Deployment scaling — which is one of the more confusing first encounters with Kubernetes storage.

This lab deletes Pods and volumes on purpose. Run it on a throwaway cluster, never against anything holding data you need.

Hands-on environment

Run this lab in a real terminal, free and in your browser. The environment is temporary and yours alone — break it as much as you like.

Open the terminal

Opens in Killercoda, in a new tab — keep this page open for the steps.

Run it on your own machine

Run this lab on your own machine. One command starts the environment, with everything the lab needs already installed:

You will need:

  • docker
  • kubectl
  • kind
git clone https://github.com/EgyKode/EgyKode-lab.git
cd EgyKode-lab
./egykode start k8s
./egykode shell

You need Docker and Git installed. Everything else runs inside the environment. The first start downloads it and takes a few minutes; later starts are seconds.

Not sure what you already have? Run: npm run doctor — it checks and changes nothing.

Anything you tick here is your own record. EgyKode cannot see inside that terminal, so the success criteria stay self-assessed even when the environment checks your work for you.

Prove the filesystem is disposable

Step 1 of 5

Clean up#

Run this even if you did not finish.

DestructiveThis removes real resources. Check which environment you are in first.

Terminal
kubectl delete deployment,pod --all
kubectl delete pvc --all          # PVCs are NOT removed with the workload
kubectl get pv                    # confirm nothing is Released and lingering
# On a cloud cluster, unattached volumes keep billing:
aws ec2 describe-volumes --filters Name=status,Values=available --query 'Volumes[].[VolumeId,Size]' --output table

Cost of this lab: Free on kind or minikube. On a cloud cluster each PVC provisions a real disk billed per GB-month — see cleanup.

Success criteria

0 of 4

The concept behind it

Ready to try it without help?Do the challenge

Next up

Lab 34 of 59 on the project path

Core Kubernetes Workloads, ConfigMaps & SecretsGet the application running on Kubernetes with its configuration and secrets outside the image.31 minIntermediate

Previous: Kubernetes Services & Service Discovery