Lab: PV and PVC

In this lab we will cover:

  • PV, PVC using hostpath
  • emptydir

Lab1:

kubectl create -f pv.yaml
kubectl get pv
kubectl describe pv pv-volume-2

Lab 2: Create PVC

kubectl create -f pvc.yaml
kubectl get pvc

Lab3: Map PVC to pod

kubectl create -f pvpod.yaml
kubectl get pod
kubectl exec mypod -it -c myfrontend -- /bin/bash
cd /var/www/html
#create a file using below cmd
touch a
#exit from the pod:
exit
#check the file created on local directory
ls /mnt/data/

Lab 4: emptydir

kubectl create -f emptydirpod.yaml
kubectl get pod example-pod-1
kubectl describe pod example-pod-1