I am testing out GKE with attaching existing disk using this GCP tutorial. I've created a Storage Class for my storage with the reclaimPolicy set to Delete
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: pd-ssd
provisioner: pd.csi.storage.gke.io
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
parameters:
type: pd-ssd
However after attaching my GCP persistent disk using PV below, I found that my reclaimPolicy is set to retain again. Even after patching the PV back to Delete. The disk still fails to auto delete from my GCP Persistent Disk page (After using the disk with PVC and Pod and deleted). Am I doing anything wrong? or is this the mechanism for GCP that persistent disk can't be auto deleted when using PV static provisioning. Thank you very much for your response in advance.
apiVersion: v1
kind: PersistentVolume
metadata:
name: test-pv
spec:
storageClassName: "pd-ssd"
capacity:
storage: 50Gi
accessModes:
- ReadWriteOnce
claimRef:
namespace: default
name: test-pvc
csi:
driver: pd.csi.storage.gke.io
volumeHandle: projects/{project}/zones/{zone-of-my-disk}/disks/{my-disk-name}
fsType: ext4