<p>Situation:
I have a problem with my PVC. 
I need to use helm chart to update our monitoring. But we dont have tiller, so we have to use 
helm template for creating our yaml files, so that we are able to deploy it with kubectl. We need sometimes to update our helm charts, so we need to repeat the process often.</p>

<p>Problem:
With "Kubectl delete -f FILE_WITH_YAMLS.yaml &amp;&amp;  Kubectl create -f FILE_WITH_YAMLS.yaml ", it deletes
everything, even our PVC (+ PV). But i don't want to delete the PVC.</p>

<p>Solution:
1. I had the idea that a delete on our PVC should be forbidden, so that we get a warning to delete it.
According this: <a href="https://stackoverflow.com/questions/51358856/kubernetes-cant-delete-persistentvolumeclaim-pvc">Kubernetes: Can&#39;t delete PersistentVolumeClaim (pvc)</a>
It should be possible to set </p>

<pre><code>Finalizers:    [kubernetes.io/pvc-protection]
</code></pre>

<p>but its not working...</p>

<ol start="2">
<li><p>Delete the PVC from FILE_WITH_YAMLS.yaml. It wouldn't be deleted again with "kubectl delete -f FILE_WITH_YAMLS.yaml". But its easy to forget to delete the PVC, so i think its too risky. </p></li>
<li><p>??? Do you have any ideas?</p></li>
</ol>

<p>My PVC form cluster looks like this:</p>

<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    pv.kubernetes.io/bind-completed: "yes"
    pv.kubernetes.io/bound-by-controller: "yes"
    volume.beta.kubernetes.io/storage-provisioner: cinder.csi.openstack.org
  creationTimestamp: "2020-05-11T07:15:11Z"
  finalizers:
  - kubernetes.io/pvc-protection
  labels:
    app: prometheus
    chart: prometheus-10.4.0
    component: server
    heritage: Tiller
    release: monitoring
  name: monitoring-prometheus-server
  namespace: monitoring
  resourceVersion: "114848084"
  selfLink: /api/v1/namespaces/monitoring/persistentvolumeclaims/monitoring-prometheus-server
  uid: 3430de7d-d167-41c7-92cc-eb15803cdca7
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 15Gi
  storageClassName: cinder
  volumeMode: Filesystem
  volumeName: pvc-3430de7d-d167-41c7-92cc-eb15803cdca7
status:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 15Gi
  phase: Bound

</code></pre>

<p>Thanks for any help!</p>

goku736
<p>I didnot try the solution but might work.Label the resources that you want delete like
<strong>delete=true</strong> ..etc</p>

<p>After that in the delete command specify the label like</p>

<pre><code>kubectl delete -f *.yaml -l delete=true
</code></pre>
