<p>I'm new to GKE-Python. I would like to delete my GKE(Google Kubernetes Engine) cluster using a python script.
I found an API <strong>delete_cluster()</strong> from the <strong>google-cloud-container</strong> python library to delete the GKE cluster.
<a href="https://googleapis.dev/python/container/latest/index.html" rel="nofollow noreferrer">https://googleapis.dev/python/container/latest/index.html</a></p>
<p>But I'm not sure how to use that API by passing the required parameters in python. Can anyone explain me with an example?</p>
<p>Or else If there is any other way to delete the GKE cluster in python?</p>
<p>Thanks in advance.</p>

Pepper
<p>This <a href="https://googleapis.dev/python/container/latest/gapic/v1/api.html" rel="nofollow noreferrer">page</a> contains an example for the command you are trying to perform.</p>
<p>To give some more details that are required for the command to succeed -
Your environment needs to contain environment variables, <a href="https://cloud.google.com/docs/authentication/getting-started" rel="nofollow noreferrer">this page</a> contains instructions for how to do that.</p>
<p>Once your environment is successfully authenticated we can run the delete cluster command like so -</p>
<pre><code>from google.cloud import container_v1

client = container_v1.ClusterManagerClient()

response = client.delete_cluster(name=projects/&lt;project&gt;/locations/&lt;location&gt;/clusters/&lt;cluster&gt;)
</code></pre>
