This page contains an overview of the Kubernetes API.
The REST API is the fundamental fabric of Kubernetes. All operations and communications between components are REST API calls handled by the API Server, including external user commands. Consequently, everything in the Kubernetes platform is treated as an API object and has a corresponding entry in the API.
Most operations can be performed through the kubectl command-line interface or other command-line tools, such as kubeadm, which in turn use the API. However, the API can also be accessed directly using REST calls.
To make it easier to eliminate fields or restructure resource representations, Kubernetes supports
multiple API versions, each at a different API path, such as /api/v1
or
/apis/extensions/v1beta1
.
The version is set at the API level rather than at the resource or field level to ensure that the API presents a clear, consistent view of system resources and behavior, and to enable controlling access to end-of-life and/or experimental APIs. The JSON and Protobuf serialization schemas follow the same guidelines for schema changes; all descriptions below cover both formats.
Note that API versioning and software versioning are only indirectly related. The API and release versioning proposal describes the relationship between API versioning and software versioning.
Different API versions imply different levels of stability and support. The criteria for each level are described in more detail in the API Changes documentation.
The criteria are summarized here:
alpha
(for example, v1alpha1
).beta
(for example, v2beta3
).vX
where X
is an integer.API groups make it easier to extend the Kubernetes API. The API group is specified in a REST path and in the apiVersion
field of a serialized object.
Currently, there are several API groups in use:
/api/v1
and is not specified as part of the apiVersion
field, for example, apiVersion: v1
./apis/$GROUP_NAME/$VERSION
, and use apiVersion: $GROUP_NAME/$VERSION
(for example, apiVersion: batch/v1
). Full list of supported API groups can be seen in Kubernetes API reference.There is a supported path to extending the API: * Third Party Resources are for users with very basic CRUD needs.
Certain resources and API groups are enabled by default. You can enable or disable them by setting --runtime-config
on apiserver. --runtime-config
accepts comma separated values. For example, to disable batch/v1, set
--runtime-config=batch/v1=false
, to enable batch/v2alpha1, set --runtime-config=batch/v2alpha1
.
The flag accepts comma separated set of key=value pairs describing runtime configuration of the apiserver.
IMPORTANT: Enabling or disabling groups or resources requires restarting apiserver and controller-manager
to pick up the --runtime-config
changes.
DaemonSets, Deployments, HorizontalPodAutoscalers, Ingress, Jobs and ReplicaSets are enabled by default.
You can enable other extensions resources by setting --runtime-config
on
apiserver. --runtime-config
accepts comma separated values. For example, to disable deployments and jobs, set
--runtime-config=extensions/v1beta1/deployments=false,extensions/v1beta1/jobs=false