Here, I am covering concepts of
persistent volume (PV) &
persistent volume claim (PVC). In the previous blog I have covered how to deploy PHPMyAdmin application in kubernetes. PHPMyAdmin application does not have a persistent storage. Hence If MySQL pod die due to some unexpected error for e.g. resource crunch then data stored in database will also get deleted as data by default stored in pod. Pods by default are stateless in nature. Hence to persist MySQL data
PVC is required.
Storage provisioned by administrator. Learn more here
Request for a storage by user. Learn more here
Follow Deploy phpMyAdmin application on kubernetes blog
I have created NFS mount at
/mnt/share location on VM with IP
kubectl create -f db-pv.yaml
kubectl create -f db-pvc.yaml
kubectl get pvc
kubectl get pv
kubectl delete deployment db
kubectl create -f db-deployment.yaml
db-deployment.yaml is updated YAML with volume & volume mounts. Next watch pods.
kubectl get pods -n watch
Exit once db pod goes into running state.