The Kubernetes API
The Kubernetes API uses JSON over HTTP for its requests and responses. It follows the REST architectural style. You can use the Kubernetes API to read and write Kubernetes resource objects.
Note
For more details about the RESTful API, please refer to https://restfulapi.net/.
Kubernetes API allows clients to create, update, delete, or read a description of an object via standard HTTP methods (or HTTP verbs), such as the examples in the following table:
In the context of Kubernetes API calls, it is helpful to understand how these HTTP methods map to API request verbs. So, let's take a look at which verbs are sent through which methods:
GET
:get
,list
, andwatch
Some example kubectl commands are
kubectl get pod
,kubectl describe pod <pod-name>
, andkubectl get pod -w
.POST
:create
An example kubectl command is
kubectl create -f <filename.yaml>
.PATCH
:patch
An example...