Kind is the type of an entity. Each object has a field Kind
which tells a client—such as kubectl
or oc—that it represents
There are three categories of Kinds
:
- Objects represent a persistent entity in the system. An object may have multiple resources that clients can use to perform specific actions. Examples:
Pod
andNamespace
. - Lists are collections of resources of one or more kinds of entities. Lists have a limited set of common metadata. Examples:
PodLists
andNodeLists
. - Special purpose kinds are for example used for specific actions on objects and for non-persistent entities such as
/binding
or/status
, discovery usesAPIGroup
andAPIResource
, error results useStatus
, etc.
API Group is a collection of Kinds
that are logically related. For example, all batch objects like Job
or ScheduledJob
are in the batch
API Group.
Version. Each API Group can exist in multiple versions. For example, a group first appears as v1alpha1
and is then promoted to v1beta1
and finally graduates to v1
. An object created in one version (e.g. v1beta1
) can be retrieved in each of the supported versions (for example as v1
). The API server does lossless conversion to return objects in the requested version.
Resource is the representation of a system entity sent or retrieved as JSON via HTTP; can be exposed as an individual resource (such as .../namespaces/default
) or collections of resources (like .../jobs
).
An API Group, a Version and a Resource (GVR) uniquely defines a HTTP path:
More precisely, the actual path for jobs is /apis/batch/v1/namespaces/$NAMESPACE/jobs
because jobs are not a cluster-wide resource, in contrast to, for example, node resources. For brevity, we omit the $NAMESPACE
segment of the paths throughout the post.
Note that **Kinds
** may not only exist in different versions, but also in different API Groups simultaneously. For example, Deployment
started as an alpha Kind
in the extensions group and was eventually promoted to a GA version in its own group apps.k8s.io
. Hence, to identify Kinds
uniquely you need the API Group, the version and the kind name (GVK).
Kinds & Resources:每个 GV 都包含多个 API 类型,称为 Kinds,在不同的 Versions 之间同一个 Kind 定义可能不同, Resource 是 Kind 的对象标识(),一般来说 Kinds 和 Resources 是 1:1 的,比如 pods Resource 对应 Pod Kind,但是有时候相同的 Kind 可能对应多个 Resources,比如 Scale Kind 可能对应很多 Resources:deployments/scale,replicasets/scale,对于 CRD 来说,只会是 1:1 的关系。