Kubernetes REST API
You can see all the API calls kubectl is making by passing --v=8
to any kubectl command
The REST API is fully documented on the Kubernetes website:https://kubernetes.io/docs/reference/using-api/api-overview/
It includes info on how to reach the API, be authorized to use the API, and a full breakdown of what API objects are available and what operations you can do on them.
The API is available to you outside of kubectl
. In fact, my understanding is that underneath it all kubectl
is just making REST calls to the API server. In a cluster using TLS certificates for authentication, a curl call to list your pods might look something like this (you can get your apiserver location/port with kubectl cluster-info | grep 'Kubernetes master'
):
curl --cert myuser.pem --key myuser-key.pem --cacert /path/to/ca.pem https://my-prod-cluster-apiserver:6443/api/v1/pods
This doc shows how to use kubectl proxy
to allow you to explore the Swagger-generated API docs on your own cluster.