<p>I need to delete POD on my GCP kubernetes cluster. Actually in Kubernetes Engine API <a href="https://cloud.google.com/kubernetes-engine/docs/reference/rest/" rel="noreferrer">documentation</a> I can find only REST api's for: <code>projects.locations.clusters.nodePools</code>, but nothing for PODs.</p>

Ted
<p>The GKE API is used to manage the cluster itself on an infrastructure level. To manage Kubernetes resources, you'd have to use the Kubernetes API. There are clients for various languages, but of course you can also directly call the API.</p>

<p>Deleting a Pod from within another or the same Pod:</p>

<pre class="lang-sh prettyprint-override"><code>PODNAME=ubuntu-xxxxxxxxxx-xxxx
curl https://kubernetes/api/v1/namespaces/default/pods/$PODNAME \
  -X DELETE -k \
  -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)"
</code></pre>

<p>From outside, you'd have to use the public Kubernetes API server URL and a valid token. Here's how you get those using <code>kubectl</code>:</p>

<pre class="lang-sh prettyprint-override"><code>APISERVER=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')
TOKEN=$(kubectl get secret $(kubectl get serviceaccount default -o jsonpath='{.secrets[0].name}') -o jsonpath='{.data.token}' | base64 --decode )
</code></pre>

<p>Here's more official information on accessing the <a href="https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/" rel="nofollow noreferrer">Kubernetes API server</a>.</p>
