Search⌘ K

Removing Resources and Exploring Effects

Explore the effects of deleting deployments, PersistentVolumeClaims, and PersistentVolumes in Kubernetes. Understand how the Retain reclaim policy works with manual EBS volume management and prepare for dynamic provisioning in AWS.

Deleting the Deployment

Let’s delete the jenkins Deployment:

Shell
kubectl --namespace jenkins delete \
deploy jenkins

The output shows us that the deployment "jenkins" is deleted.

Did anything happen with the PersistentVolumeClaim and the PersistentVolume?

Shell
kubectl --namespace jenkins get pvc
kubectl get pv

The combined output of both commands is as follows:

Shell
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
jenkins Bound manual-ebs-02 5Gi RWO manual-ebs 57s
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
manual-ebs-01 5Gi RWO Retain Available jenkins/jenkins manual-ebs 10m
manual-ebs-02 5Gi RWO Retain Bound jenkins/jenkins manual-ebs 10m
manual-ebs-03 5Gi RWO Retain Available jenkins/jenkins manual-ebs 10m

Even though we have removed the Jenkins Deployment and the Pod that used the claim, both the PersistentVolumeClaim and PersistentVolumes are intact. The manual-ebs-01 volume is still bound to the jenkins claim.

Deleting the PersistentVolumeClaim

What would happen if we remove the PersistentVolumeClaim jenkins?

Shell
kubectl --namespace jenkins \
delete pvc jenkins

The output shows that the persistentvolumeclaim "jenkins" is deleted ...