<p>I'm creating Kubernetes clusters programmatically for end-to-end tests in GitLab CI/CD. I'm using <code>gcloud container clusters create</code>. I'm doing this for half a year and created and deleted a few hundred clusters. The cost went up and down. Now, I got an unusually high bill from Google and I checked the cost breakdown. I noticed that the cost is >95% for "Storage PD Capacity". I found out that <code>gcloud container clusters delete</code> never deleted the Google Compute Disks created for Persistent Volume Claims in the Kubernetes cluster.</p>

<p>How can I delete those programmatically? What else could be left running after deleting the Kubernetes cluster and the disks?</p>

<p>Suggestions:</p>

<ol>
<li><p>To answer your immediate question: you can programatically delete your disk resource(s) with the <a href="https://cloud.google.com/compute/docs/reference/rest/v1/disks/delete" rel="nofollow noreferrer">Method: disks.delete</a> API.</p></li>
<li><p>To determine what other resources might have been allocated, look here: <a href="https://cloud.google.com/resource-manager/docs/listing-all-resources" rel="nofollow noreferrer">Listing all Resources in your Hierarchy</a>.</p></li>
<li><p>Finally, this link might also help: <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-usage-metering" rel="nofollow noreferrer">GKE: Understanding cluster resource usage </a></p></li>
</ol>
