Kubernetes Api Basics
Fleeting- External reference: https://iximiuz.com/en/posts/kubernetes-api-structure-and-terminology/
Kubernetes API Basics - Resources, Kinds, and Objects
Make Kubernetes API available on localhost:8080
$ kubectl proxy –port=8080 &
— https://iximiuz.com/en/posts/kubernetes-api-structure-and-terminology/
simpler way to examine the Kubernetes API: kubectl get –raw /SOME/API/PATH.
— https://iximiuz.com/en/posts/kubernetes-api-structure-and-terminology/
API resources should use the traditional REST pattern:
GET /<resourceNamePlural> - Retrieve a list of type <resourceName>, e.g. GET /pods returns a list of Pods. POST /<resourceNamePlural> - Create a new resource from the JSON object provided by the client. GET /<resourceNamePlural>/<name> - Retrieves a single resource with the given name, e.g. GET /pods/first returns a Pod named ‘first’. Should be constant time, and the resource should be bounded in size. DELETE /<resourceNamePlural>/<name> - Delete the single resource with the given name. DeleteOptions may specify gracePeriodSeconds, the optional duration in seconds before the object should be deleted. Individual kinds may declare fields which provide a default grace period, and different kinds may have differing kind-wide default grace periods. A user provided grace period overrides a default grace period, including the zero grace period (“now”). DELETE /<resourceNamePlural> - Deletes a list of type <resourceName>, e.g. DELETE /pods a list of Pods. PUT /<resourceNamePlural>/<name> - Update or create the resource with the given name with the JSON object provided by the client. PATCH /<resourceNamePlural>/<name> - Selectively modify the specified fields of the resource. See more information below. GET /<resourceNamePlural>?watch=true - Receive a stream of JSON objects corresponding to changes made to any resource of the given kind over time.
One of the goals of
— https://iximiuz.com/en/posts/kubernetes-api-structure-and-terminology/
make sure that working with one Kubernetes resource feels exactly the same as with any other Kubernetes resources, including custom resources. This way learning how to deal with one resource makes your fluent with the rest of the API
— https://iximiuz.com/en/posts/kubernetes-api-structure-and-terminology/
t, in Kubernetes, a kind is the name of an object schema. Like the one you’d typically describe using a JSON schema vocabulary. In other words, a kind refers to a particular data structure, i.e. a certain composition of attributes and properties
— https://iximiuz.com/en/posts/kubernetes-api-structure-and-terminology/
kinds are grouped into three categories:
Objects (Pod, Service, etc) - persistent entities in the system. Lists - (PodList, APIResourceList, etc) - collections of resources of one or more kinds. Simple - specific actions on objects (status, scale, etc.) or non-persistent auxiliary entities (ListOptions, Policy, etc).
— https://iximiuz.com/en/posts/kubernetes-api-structure-and-terminology/
Objects are persistent entities in the Kubernetes system that represent an intent (desired state) and the status (actual state) of the cluster
— https://iximiuz.com/en/posts/kubernetes-api-structure-and-terminology/
For instance, once you create a Pod Object, Kubernetes will constantly work to ensure that the corresponding collection of containers is running
— https://iximiuz.com/en/posts/kubernetes-api-structure-and-terminology/
The kubectl explain command can help you with that. The coolest part about it is that it can be called not only on resources but also on the nested field
— https://iximiuz.com/en/posts/kubernetes-api-structure-and-terminology/