Black lives matter.
We stand in solidarity with the Black community.
Racism is unacceptable.
It conflicts with the core values of the Kubernetes project and our community does not tolerate it.
We stand in solidarity with the Black community.
Racism is unacceptable.
It conflicts with the core values of the Kubernetes project and our community does not tolerate it.
The core of Kubernetes' control planeThe container orchestration layer that exposes the API and interfaces to define, deploy, and manage the lifecycle of containers. is the API serverControl plane component that serves the Kubernetes API. . The API server exposes an HTTP API that lets end users, different parts of your cluster, and external components communicate with one another.
The Kubernetes API lets you query and manipulate the state of objects in the Kubernetes API (for example: Pods, Namespaces, ConfigMaps, and Events).
API endpoints, resource types and samples are described in the API Reference.
Any system that is successful needs to grow and change as new use cases emerge or existing ones change. Therefore, Kubernetes has design features to allow the Kubernetes API to continuously change and grow. The Kubernetes project aims to not break compatibility with existing clients, and to maintain that compatibility for a length of time so that other projects have an opportunity to adapt.
In general, new API resources and new resource fields can be added often and frequently. Elimination of resources or fields requires following the API deprecation policy.
What constitutes a compatible change, and how to change the API, are detailed in API changes.
Complete API details are documented using OpenAPI.
The Kubernetes API server serves an OpenAPI spec via the /openapi/v2
endpoint.
You can request the response format using request headers as follows:
Header | Possible values | Notes |
---|---|---|
Accept-Encoding |
gzip |
not supplying this header is also acceptable |
Accept |
application/com.github.proto-openapi.spec.v2@v1.0+protobuf |
mainly for intra-cluster use |
application/json |
default | |
* |
serves application/json |
Kubernetes implements an alternative Protobuf based serialization format for the API that is primarily intended for intra-cluster communication, documented in the design proposal and the IDL files for each schema are located in the Go packages that define the API objects.
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
.
Versioning is done 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 Kubernetes 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. They are summarized here:
alpha
(e.g. v1alpha1
).beta
(e.g. v2beta3
).vX
where X
is an integer.To make it easier to extend its API, Kubernetes implements API groups.
The API group is specified in a REST path and in the apiVersion
field of a serialized object.
There are several API groups in a cluster:
The core group, also referred to as the legacy group, is at the REST path /api/v1
and uses apiVersion: v1
.
Named groups are at REST path /apis/$GROUP_NAME/$VERSION
, and use apiVersion: $GROUP_NAME/$VERSION
(e.g. apiVersion: batch/v1
). The Kubernetes API reference has a
full list of available API groups.
There are two paths to extending the API with custom resources:
Certain resources and API groups are enabled by default. They can be enabled or disabled by setting --runtime-config
as a command line option to the kube-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 API server.
Note: Enabling or disabling groups or resources requires restarting the kube-apiserver and the kube-controller-manager to pick up the--runtime-config
changes.
DaemonSets, Deployments, StatefulSet, NetworkPolicies, PodSecurityPolicies and ReplicaSets in the extensions/v1beta1
API group are disabled by default.
For example: to enable deployments and daemonsets, set
--runtime-config=extensions/v1beta1/deployments=true,extensions/v1beta1/daemonsets=true
.
Note: Individual resource enablement/disablement is only supported in theextensions/v1beta1
API group for legacy reasons.
Kubernetes stores its serialized state in terms of the API resources by writing them into etcdConsistent and highly-available key value store used as Kubernetes' backing store for all cluster data. .
Controlling API Access describes how the cluster manages authentication and authorization for API access.
Overall API conventions are described in the API conventions document.
API endpoints, resource types and samples are described in the API Reference.