2017-04-20 20:04:32 +00:00
---
title: Kubernetes API Overview
2018-05-21 15:55:51 +00:00
reviewers:
2017-04-20 20:04:32 +00:00
- bgrant0607
- erictune
- lavalamp
- jbeda
2018-05-05 16:00:51 +00:00
content_template: templates/concept
2018-05-23 17:58:32 +00:00
weight: 10
2019-02-21 16:24:20 +00:00
card:
name: reference
weight: 50
title: Overview of API
2017-04-20 20:04:32 +00:00
---
2018-05-05 16:00:51 +00:00
{{% capture overview %}}
2018-04-09 12:58:08 +00:00
This page provides an overview of the Kubernetes API.
2018-05-05 16:00:51 +00:00
{{% /capture %}}
2017-05-14 23:05:50 +00:00
2018-05-05 16:00:51 +00:00
{{% capture body %}}
2018-04-09 12:58:08 +00:00
The REST API is the fundamental fabric of Kubernetes. All operations and communications between components, and external user commands are REST API calls that the API Server handles. Consequently, everything in the Kubernetes
2017-04-20 20:04:32 +00:00
platform is treated as an API object and has a corresponding entry in the
2018-05-05 16:00:51 +00:00
[API ](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/ ).
2017-04-20 20:04:32 +00:00
Most operations can be performed through the
2018-04-09 12:58:08 +00:00
[kubectl ](/docs/reference/kubectl/overview/ ) command-line interface or other
command-line tools, such as [kubeadm ](/docs/reference/setup-tools/kubeadm/kubeadm/ ), which in turn use
the API. However, you can also access the API directly using REST calls.
2017-04-20 20:04:32 +00:00
2018-06-01 19:58:57 +00:00
Consider using one of the [client libraries ](/docs/reference/using-api/client-libraries/ )
2017-07-09 02:25:05 +00:00
if you are writing an application using the Kubernetes API.
2017-04-20 20:04:32 +00:00
## API versioning
2018-04-09 12:58:08 +00:00
To eliminate fields or restructure resource representations, Kubernetes supports
multiple API versions, each at a different API path. For example: `/api/v1` or
2017-04-20 20:04:32 +00:00
`/apis/extensions/v1beta1` .
2018-04-09 12:58:08 +00:00
The version is set at the API level rather than at the resource or field level to:
2018-08-03 16:44:09 +00:00
2018-04-09 12:58:08 +00:00
- Ensure that the API presents a clear and consistent view of system resources and behavior.
- Enable control access to end-of-life and/or experimental APIs.
2017-04-20 20:04:32 +00:00
2018-04-09 12:58:08 +00:00
The JSON and Protobuf serialization schemas follow the same guidelines for schema changes. The following descriptions cover both formats.
2017-04-20 20:04:32 +00:00
2018-05-05 16:00:51 +00:00
{{< note > }}
2018-11-06 19:33:04 +00:00
The API versioning and software versioning are indirectly related. The [API and release
2018-04-09 12:58:08 +00:00
versioning proposal](https://git.k8s.io/community/contributors/design-proposals/release/versioning.md) describes the relationship between API versioning and software versioning.
2018-05-05 16:00:51 +00:00
{{< / note > }}
2017-05-14 23:05:50 +00:00
2018-04-09 12:58:08 +00:00
Different API versions indicate different levels of stability and support. You can find more information about the criteria for each level in the [API Changes documentation ](https://git.k8s.io/community/contributors/devel/api_changes.md#alpha-beta-and-stable-versions ).
2017-04-20 20:04:32 +00:00
2018-04-09 12:58:08 +00:00
Here's a summary of each level:
2018-05-23 02:45:10 +00:00
2018-04-09 12:58:08 +00:00
- Alpha:
2017-05-14 23:05:50 +00:00
- The version names contain `alpha` (for example, `v1alpha1` ).
2018-04-09 12:58:08 +00:00
- The software may contain bugs. Enabling a feature may expose bugs. A feature may be disabled by default.
2017-05-14 23:05:50 +00:00
- The support for a feature may be dropped at any time without notice.
2017-04-20 20:04:32 +00:00
- The API may change in incompatible ways in a later software release without notice.
2018-05-23 02:45:10 +00:00
- The software is recommended for use only in short-lived testing clusters, due to increased risk of bugs and lack of long-term support.
2018-04-09 12:58:08 +00:00
- Beta:
2017-05-14 23:05:50 +00:00
- The version names contain `beta` (for example, `v2beta3` ).
2018-04-09 12:58:08 +00:00
- The software is well tested. Enabling a feature is considered safe. Features are enabled by default.
2017-05-14 23:05:50 +00:00
- The support for a feature will not be dropped, though the details may change.
2018-04-09 12:58:08 +00:00
- The schema and/or semantics of objects may change in incompatible ways in a subsequent beta or stable release. When this happens, migration instructions are provided. This may require deleting, editing, and re-creating
2017-05-14 23:05:50 +00:00
API objects. The editing process may require some thought. This may require downtime for applications that rely on the feature.
2018-04-09 12:58:08 +00:00
- The software is recommended for only non-business-critical uses because of potential for incompatible changes in subsequent releases. If you have multiple clusters which can be upgraded independently, you may be able to relax this restriction.
2018-05-05 16:00:51 +00:00
{{< note > }}
2018-11-06 19:33:04 +00:00
Try the beta features and provide feedback. After the features exit beta, it may not be practical to make more changes.
2018-05-05 16:00:51 +00:00
{{< / note > }}
2018-04-09 12:58:08 +00:00
- Stable:
2017-04-20 20:04:32 +00:00
- The version name is `vX` where `X` is an integer.
2018-04-09 12:58:08 +00:00
- The stable versions of features appear in released software for many subsequent versions.
2017-04-20 20:04:32 +00:00
## API groups
2017-09-21 13:20:58 +00:00
[*API groups* ](https://git.k8s.io/community/contributors/design-proposals/api-machinery/api-group.md ) 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.
2017-04-20 20:04:32 +00:00
2017-05-14 23:05:50 +00:00
Currently, there are several API groups in use:
2017-04-20 20:04:32 +00:00
2017-05-14 23:05:50 +00:00
* The *core* (also called *legacy* ) group, which is at REST path `/api/v1` and is not specified as part of the `apiVersion` field, for example, `apiVersion: v1` .
* The named groups are at REST path `/apis/$GROUP_NAME/$VERSION` , and use `apiVersion: $GROUP_NAME/$VERSION`
2018-04-09 12:58:08 +00:00
(for example, `apiVersion: batch/v1` ). You can find the full list of supported API groups in [Kubernetes API reference ](/docs/reference/ ).
2017-04-20 20:04:32 +00:00
2018-04-09 12:58:08 +00:00
The two paths that support extending the API with [custom resources ](/docs/concepts/api-extension/custom-resources/ ) are:
2017-06-22 23:48:48 +00:00
2018-04-09 12:58:08 +00:00
- [CustomResourceDefinition ](/docs/tasks/access-kubernetes-api/extend-api-custom-resource-definitions/ )
for basic CRUD needs.
- [aggregator ](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/aggregated-api-servers.md ) for a full set of Kubernetes API semantics to implement their own apiserver.
2017-05-14 23:05:50 +00:00
2017-04-20 20:04:32 +00:00
## Enabling API groups
2018-04-09 12:58:08 +00:00
Certain resources and API groups are enabled by default. You can enable or disable them by setting `--runtime-config`
on the 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`
2017-04-20 20:04:32 +00:00
The flag accepts comma separated set of key=value pairs describing runtime configuration of the apiserver.
2018-05-05 16:00:51 +00:00
{{< note > }}
2018-11-06 19:33:04 +00:00
When you enable or disable groups or resources, you need to restart the apiserver and controller-manager
2017-04-20 20:04:32 +00:00
to pick up the `--runtime-config` changes.
2018-05-05 16:00:51 +00:00
{{< / note > }}
2017-04-20 20:04:32 +00:00
## Enabling resources in the groups
DaemonSets, Deployments, HorizontalPodAutoscalers, Ingress, Jobs and ReplicaSets are enabled by default.
2017-05-14 23:05:50 +00:00
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`
2018-05-05 16:00:51 +00:00
{{% /capture %}}
2017-05-14 23:05:50 +00:00