Kubernetes - APIs
The /api
endpoint is already legacy and used only for core resources (pods, secrets, configmaps, etc.). A more modern and generic /apis/<group-name>
endpoint is used for the rest of resources, including user-defined custom resources.
k8s.io (in-tree): Core
- code path
k8s.io/api
- REST Path:
/api/v1
apiVersion
: "core" is skipped, i.e.apiVersion: v1
.- Source code: https://github.com/kubernetes/kubernetes/tree/master/pkg/api
e.g.
apiVersion: v1
kind: Pod
k8s.io (in-tree): Non-core
- REST Path:
/apis/$GROUP_NAME/$VERSION
apiVersion
:$GROUP_NAME/$VERSION
, e.g.apiVersion: batch/v1
- Groups without
k8s.io
:apps/v1
,batch/v1
,policy/v1
,autoscaling/v2
- Groups with
k8s.io
:metrics.k8s.io
,networking.k8s.io
,node.k8s.io
,storage.k8s.io
,rbac.authorization.k8s.io
- Source code: https://github.com/kubernetes/kubernetes/tree/master/pkg/apis
E.g.
apiVersion: apps/v1
kind: Deployment
k8s.io: sigs / extensions
Separate repos under https://github.com/kubernetes-sigs
kind.x-k8s.io
: kind, import pathsigs.k8s.io/kind
.cluster.x-k8s.io
: Cluster api, import pathsigs.k8s.io/cluster-api
.
E.g.
apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster
Addons
other projects, e.g.
- knative.dev
- kubevirt.io
- istio.io
Custom Resources
Add your own APIs.