Using the API
The API reference is a detailed document, available on the internet https://kubernetes.io/docs/api-reference/v1.6/; of course the API version will change in the future, v1.6
was the current one at the time of writing.
Before we make some actual calls to the api-server
, it's worth knowing that kubectl
also communicates with Kubernetes cluster using the API. As we mentioned earlier, you can see what REST
calls are being made by the kubectl
command. Looking at what's being sent to the server during the usage of kubectl
is a great way to become familiar with Kubernetes API.
Note
To see REST
requests being executed by kubectl
, run it with a higher level of verbosity, for example with a--v=6
or--v=9
option.
Before we start making actual REST
calls, let's briefly see what API operations are possible.
API operations
Kubernetes API defines the CRUD (create, update, read, and delete) set of operations:
Create
: Create operations will create the resource in the cluster. The JSON payload that you...