Feb 14, 2023
Deleting a Kubernetes Pod using cURL
The Kubernetes API is RESTful. HTTP traffic can access Kubernetes API. Thus, we can use cURL to access the Kubernetes API directly. Curl can access the Apiserver securely by going through Kube-proxy, which has direct access to the .kube/config file. This configuration file has ca-certificates, these certificates encrypt the request being sent to the API server to ensure our data is secure.
practical usage
1.) Start the Kube-proxy on the Kubernetes user workstation
kubectl proxy --port=8001
2.) Use cURL on that port to give access to Kubernetes API resources.
curl localhost:8001
3.) Access all the Kubernetes pods
curl http://localhost:8001/api/v1/namespaces/default/pods
4.) Delete a Pod
curl -XDELETE http://localhost:8001/api/v1/namespaces/default/pods/green-nginx-6bb6d45df6-6cw76