Create pv.yaml

k create -f pv.yaml

PV is created and now developer can use it .

k describe pv to get more details .

Create PVC [ Persistant Volume Claim ] before we add the PV to the POD

pvc.yaml

k create -f pvc.yaml

access mode is not matched with pv hence it is in pending stage .

k describe pvc claim-log-1

k edit pvc to match the accessModes and then k replace –force -f updated file . then check the status

now assign the PV to the POD nginx

edit the pod go to the volumes and add

under valumeMounts add what mount you want to add

Apply now

now we can write the date that will stored locally in the host .

if you want to delete the PV then you have to clear the dependency . follow below steps to do so

if you try to delete pv . it will be in termination stage . if you delete PVC even it will be in termination stage because PVC is associated with POD already

Once we remove the Mount from the pod then both PV and PVC with the termination phase will be create .

The data will be still then in the host even if you delete PV and PVC .

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *