|
1 | 1 | ---
|
2 |
| -title: Using the Kubernetes API |
| 2 | +title: Kubernetes API Overview |
| 3 | +reviewers: |
| 4 | +- erictune |
| 5 | +- lavalamp |
| 6 | +- jbeda |
| 7 | +content_type: concept |
3 | 8 | weight: 10
|
4 |
| ---- |
| 9 | +card: |
| 10 | + name: reference |
| 11 | + weight: 50 |
| 12 | + title: Overview of API |
| 13 | +--- |
| 14 | + |
| 15 | +<!-- overview --> |
| 16 | + |
| 17 | +This section provides reference information for the Kubernetes API. |
| 18 | + |
| 19 | +The REST API is the fundamental fabric of Kubernetes. All operations and |
| 20 | +communications between components, and external user commands are REST API |
| 21 | +calls that the API Server handles. Consequently, everything in the Kubernetes |
| 22 | +platform is treated as an API object and has a corresponding entry in the |
| 23 | +[API](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/). |
| 24 | + |
| 25 | +The [Kubernetes API reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/) |
| 26 | +lists the API for Kubernetes version {{< param "version" >}}. |
| 27 | + |
| 28 | +For general background information, read |
| 29 | +[The Kubernetes API](/docs/concepts/overview/kubernetes-api/). |
| 30 | + |
| 31 | +<!-- body --> |
| 32 | + |
| 33 | +The REST API is the fundamental fabric of Kubernetes. All operations and |
| 34 | +communications between components, and external user commands are REST API |
| 35 | +calls that the API Server handles. Consequently, everything in the Kubernetes |
| 36 | +platform is treated as an API object and has a corresponding entry in the |
| 37 | +API. |
| 38 | + |
| 39 | +## API versioning |
| 40 | + |
| 41 | +The JSON and Protobuf serialization schemas follow the same guidelines for |
| 42 | +schema changes. The following descriptions cover both formats. |
| 43 | + |
| 44 | +The API versioning and software versioning are indirectly related. |
| 45 | +The [API and release versioning proposal](https://git.k8s.io/community/contributors/design-proposals/release/versioning.md) |
| 46 | +describes the relationship between API versioning and software versioning. |
| 47 | + |
| 48 | +Different API versions indicate different levels of stability and support. You |
| 49 | +can find more information about the criteria for each level in the |
| 50 | +[API Changes documentation](https://git.k8s.io/community/contributors/devel/sig-architecture/api_changes.md#alpha-beta-and-stable-versions). |
| 51 | + |
| 52 | +Here's a summary of each level: |
| 53 | + |
| 54 | +- Alpha: |
| 55 | + - The version names contain `alpha` (for example, `v1alpha1`). |
| 56 | + - The software may contain bugs. Enabling a feature may expose bugs. A |
| 57 | + feature may be disabled by default. |
| 58 | + - The support for a feature may be dropped at any time without notice. |
| 59 | + - The API may change in incompatible ways in a later software release without notice. |
| 60 | + - The software is recommended for use only in short-lived testing clusters, |
| 61 | + due to increased risk of bugs and lack of long-term support. |
| 62 | + |
| 63 | +- Beta: |
| 64 | + - The version names contain `beta` (for example, `v2beta3`). |
| 65 | + - The software is well tested. Enabling a feature is considered safe. |
| 66 | + Features are enabled by default. |
| 67 | + - The support for a feature will not be dropped, though the details may change. |
| 68 | + |
| 69 | + - The schema and/or semantics of objects may change in incompatible ways in |
| 70 | + a subsequent beta or stable release. When this happens, migration |
| 71 | + instructions are provided. Schema changes may require deleting, editing, and |
| 72 | + re-creating API objects. The editing process may not be straightforward. |
| 73 | + The migration may require downtime for applications that rely on the feature. |
| 74 | + - The software is not recommended for production uses. Subsequent releases |
| 75 | + may introduce incompatible changes. If you have multiple clusters which |
| 76 | + can be upgraded independently, you may be able to relax this restriction. |
| 77 | + |
| 78 | + {{< note >}} |
| 79 | + Please try beta features and provide feedback. After the features exit beta, it |
| 80 | + may not be practical to make more changes. |
| 81 | + {{< /note >}} |
| 82 | + |
| 83 | +- Stable: |
| 84 | + - The version name is `vX` where `X` is an integer. |
| 85 | + - The stable versions of features appear in released software for many subsequent versions. |
| 86 | + |
| 87 | +## API groups |
| 88 | + |
| 89 | +[API groups](https://git.k8s.io/community/contributors/design-proposals/api-machinery/api-group.md) |
| 90 | +make it easier to extend the Kubernetes API. |
| 91 | +The API group is specified in a REST path and in the `apiVersion` field of a |
| 92 | +serialized object. |
| 93 | + |
| 94 | +There are several API groups in Kubernetes: |
| 95 | + |
| 96 | +* The *core* (also called *legacy*) group is found at REST path `/api/v1`. |
| 97 | + The core group is not specified as part of the `apiVersion` field, for |
| 98 | + example, `apiVersion: v1`. |
| 99 | +* The named groups are at REST path `/apis/$GROUP_NAME/$VERSION` and use |
| 100 | + `apiVersion: $GROUP_NAME/$VERSION` (for example, `apiVersion: batch/v1`). |
| 101 | + You can find the full list of supported API groups in |
| 102 | + [Kubernetes API reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#-strong-api-groups-strong-). |
| 103 | + |
| 104 | +## Enabling or disabling API groups {#enabling-or-disabling} |
| 105 | + |
| 106 | +Certain resources and API groups are enabled by default. You can enable or |
| 107 | +disable them by setting `--runtime-config` on the API server. The |
| 108 | +`--runtime-config` flag accepts comma separated `<key>[=<value>]` pairs |
| 109 | +describing the runtime configuration of the API server. If the `=<value>` |
| 110 | +part is omitted, it is treated as if `=true` is specified. For example: |
| 111 | + |
| 112 | + - to disable `batch/v1`, set `--runtime-config=batch/v1=false` |
| 113 | + - to enable `batch/v2alpha1`, set `--runtime-config=batch/v2alpha1` |
| 114 | + |
| 115 | +{{< note >}} |
| 116 | +When you enable or disable groups or resources, you need to restart the API |
| 117 | +server and controller manager to pick up the `--runtime-config` changes. |
| 118 | +{{< /note >}} |
| 119 | + |
| 120 | +## Persistence |
| 121 | + |
| 122 | +Kubernetes stores its serialized state in terms of the API resources by writing them into |
| 123 | +{{< glossary_tooltip term_id="etcd" >}}. |
| 124 | + |
| 125 | +## {{% heading "whatsnext" %}} |
| 126 | + |
| 127 | +- Learn more about [API conventions](https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#api-conventions) |
| 128 | +- Read the design documentation for |
| 129 | + [aggregator](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/aggregated-api-servers.md) |
0 commit comments