GKE 持久磁盘在使用静态 PV 时不会被删除。

huangapple go评论96阅读模式
英文:

GKE Persistent Disk don't get deleted when using static PV

问题

I am testing out GKE with attaching existing disk using this GCP tutorial.
我正在测试使用这个GCP教程来附加现有磁盘。

I've created a Storage Class for my storage with the reclaimPolicy set to Delete
我已经创建了一个存储类,将reclaimPolicy设置为Delete

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.
然而,在使用下面的PV附加我的GCP持久磁盘后,我发现我的reclaimPolicy再次设置为retain。即使在将PV还原为Delete后仍然如此。该磁盘仍然无法从我的GCP持久磁盘页面自动删除(在使用PVC和Pod并删除后)。我做错了什么吗?还是这是GCP的机制,当使用PV静态配置时,持久磁盘无法自动删除。非常感谢您提前的回复。

英文:

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

答案1

得分: 1

以下是翻译好的内容:

"如在文档中提到的:"
"GKE 可能不会删除以下资源:"
"1. 集群创建的外部负载均衡器。"
"2. 集群创建的内部负载均衡器。"
"3. 持久磁盘卷。"
"持久磁盘位于虚拟机(VM)实例之外,因此您可以在删除实例后分离或移动持久磁盘以保留数据。"
"如果您想永久删除磁盘,可以首先删除所有命名空间。当您删除声明时,还会删除相应的持久卷对象和预配置的 Compute Engine 持久磁盘。"

英文:

<p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt; margin: 0;"><span style="font-size: 11pt; font-family: Arial; color: #0a0a14; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">As mentioned in the </span><a href="https://cloud.google.com/kubernetes-engine/docs/how-to/deleting-a-cluster#overview"><span style="font-size: 11pt; font-family: Arial; color: #1155cc; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: underline; -webkit-text-decoration-skip: none; text-decoration-skip-ink: none; vertical-align: baseline; white-space: pre-wrap;">document</span></a><span style="font-size: 11pt; font-family: Arial; color: #0a0a14; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span></p>
<blockquote>
<p dir="ltr" style="line-height: 1.38; background-color: #ffffff; margin-top: 0pt; margin-bottom: 12pt; padding: 12pt 0pt 0pt 0pt; margin: 0;"><span style="font-size: 11pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">GKE might not delete the following resources:</span></p>
<p dir="ltr" style="line-height: 1.38; background-color: #ffffff; margin-top: 9pt; margin-bottom: 0pt; margin: 0;" role="presentation"><span style="font-size: 11pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1. External load balancers created by the cluster.</span></p>
<p dir="ltr" style="line-height: 1.38; background-color: #ffffff; margin-top: 0pt; margin-bottom: 0pt; margin: 0;" role="presentation"><span style="font-size: 11pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2. Internal load balancers created by the cluster.</span></p>
<p dir="ltr" style="line-height: 1.38; background-color: #ffffff; margin-top: 0pt; margin-bottom: 0pt; margin: 0;" role="presentation">3. <a href="https://cloud.google.com/compute/docs/disks#pdspecs"><span style="font-size: 11pt; font-family: Roboto,sans-serif; color: #1155cc; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: underline; -webkit-text-decoration-skip: none; text-decoration-skip-ink: none; vertical-align: baseline; white-space: pre-wrap;">Persistent disk</span></a><span style="font-size: 11pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> volumes</span></p>
</blockquote>
<p dir="ltr" style="line-height: 1.38; background-color: #ffffff; margin-top: 0pt; margin-bottom: 0pt; padding: 0pt 0pt 12pt 0pt; margin: 0;"><span style="font-size: 11.5pt; font-family: Arial; color: #232629; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Persistent disks are located independently from your virtual machine (VM) instances, so you can detach or move persistent disks to keep your data even after you delete your instances.&nbsp;</span></p>
<p dir="ltr" style="line-height: 1.38; background-color: #ffffff; margin-top: 0pt; margin-bottom: 12pt; margin: 0;"><span style="font-size: 11.5pt; font-family: Arial; color: #232629; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If you want to delete the disk also permanently then this can be fixed by first deleting all the namespaces. When you delete a claim, the corresponding PersistentVolume object and the provisioned Compute Engine persistent disk are also deleted.</span></p>

huangapple
  • 本文由 发表于 2023年5月25日 11:48:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76328802.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定