Home > Backend Development > Golang > How to Identify and Manage Persistent Disks After Deleting a Kubernetes Engine Cluster?

How to Identify and Manage Persistent Disks After Deleting a Kubernetes Engine Cluster?

Barbara Streisand
Release: 2024-10-24 00:13:02
Original
521 people have browsed it

How to Identify and Manage Persistent Disks After Deleting a Kubernetes Engine Cluster?

Deleting Associated Persistent Disks When Deleting a Cluster

When deleting a Kubernetes Engine cluster, persistent disks may still remain even though the cluster has been removed. To address this, consider using the Cloud SDK to identify the associated disks and take appropriate action.

The gcloud compute disks list command can be employed with specific filters and formatting to identify disks used by a cluster. For instance:

  • To list all disks utilized by a cluster:

    gcloud compute disks list --format="table(name,users)" --filter="name~^gke-"
    Copy after login
  • To list only disks used as Persistent Volume Claims (PVCs):

    gcloud compute disks list --format="table(name,users)" --filter="name~^gke-.*-pvc-.*"
    Copy after login
  • To identify detached PVC disks:

    gcloud compute disks list --format="table(name,users)" --filter="name~^gke-.*-pvc-.* AND -users:*"
    Copy after login

    To verify that a detached disk is not still in use by a cluster, employ the following kubectl command to list a cluster's PVs and their associated GCE PDs:

    kubectl get pv -o custom-columns=K8sPV:.metadata.name,GCEDisk:spec.gcePersistentDisk.pdName
    Copy after login

The API method disks.list can also be used for this purpose.

The above is the detailed content of How to Identify and Manage Persistent Disks After Deleting a Kubernetes Engine Cluster?. For more information, please follow other related articles on the PHP Chinese website!

source:php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template