Skip to content

Commit 2af22ea

Browse files
Jefftreetengqm
andcommitted
Update content/en/docs/concepts/overview/kubernetes-api.md
Co-authored-by: Qiming Teng <[email protected]>
1 parent 622466f commit 2af22ea

File tree

1 file changed

+38
-30
lines changed

1 file changed

+38
-30
lines changed

content/en/docs/concepts/overview/kubernetes-api.md

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,38 +26,41 @@ Most operations can be performed through the [kubectl](/docs/reference/kubectl/)
2626
command-line interface or other command-line tools, such as
2727
[kubeadm](/docs/reference/setup-tools/kubeadm/), which in turn use the API.
2828
However, you can also access the API directly using REST calls. Kubernetes
29-
provides a set of [client
30-
libraries](/docs/reference/using-api/client-libraries/) for those looking to
29+
provides a set of [client libraries](/docs/reference/using-api/client-libraries/)
30+
for those looking to
3131
write applications using the Kubernetes API.
3232

33-
Each Kubernetes offers publishes a machine-readable description of the APIs that the cluster serves.
34-
There are two mechanisms that Kubernetes uses to publish these API descriptions; each is useful
33+
Each Kubernetes cluster publishes the specification of the APIs that the cluster serves.
34+
There are two mechanisms that Kubernetes uses to publish these API specifications; both are useful
3535
to enable automatic interoperability. For example, the `kubectl` tool fetches and caches the API
36-
description and uses this to enable command-line completion and other features.
37-
Here is some more detail about each of those two mechanisms:
38-
39-
[The Discovery API](#discovery-api) provides information about the Kubernetes APIs: API names,
40-
resources, versions, and supported operations. This is a Kubernetes specific term as it is a separate API from the Kubernetes OpenAPI.
41-
It is intended to be a small document providing a summary of available resources
42-
and does not detail specific schema for the resources. For reference around schemas
43-
for resources, please refer to the OpenAPI document.
44-
45-
The [Kubernetes OpenAPI Document]{#openapi-specification} provides (full) [OpenAPI v2.0 and 3.0 schemas](https://www.openapis.org/) for all Kubernetes API
46-
endpoints. OpenAPI v3 is the preferred method for accessing OpenAPI as it
47-
provides a more comprehensive and accurate view of the API. It includes all
48-
available API paths, as well as all resources consumed and produced for every
49-
operation on every endpoint. This also includes any extensibility components
50-
that a cluster supports. This document a complete document and is significantly larger than Discovery. The Discovery API is a
51-
lightweight alternative that provides a subset of information in the
52-
Kubernetes OpenAPI document.
36+
specification for enabling command-line completion and other features.
37+
The two supported mechanisms are as follows:
38+
39+
- [The Discovery API](#discovery-api) provides information about the Kubernetes APIs:
40+
API names, resources, versions, and supported operations. This is a Kubernetes
41+
specific term as it is a separate API from the Kubernetes OpenAPI.
42+
It is intended to be a brief summary of the available resources and it does not
43+
detail specific schema for the resources. For reference about resource schemas,
44+
please refer to the OpenAPI document.
45+
46+
- The [Kubernetes OpenAPI Document](#openapi-specification) provides (full)
47+
[OpenAPI v2.0 and 3.0 schemas](https://www.openapis.org/) for all Kubernetes API
48+
endpoints.
49+
The OpenAPI v3 is the preferred method for accessing OpenAPI as it
50+
provides
51+
a more comprehensive and accurate view of the API. It includes all the available
52+
API paths, as well as all resources consumed and produced for every operations
53+
on every endpoints. It also includes any extensibility components that a cluster supports.
54+
The data is a complete specification and is significantly larger than that from the
55+
Discovery API.
5356

5457
## Discovery API
5558

5659
Kubernetes publishes a list of all group versions and resources supported via
5760
the Discovery API. This includes the following for each resource:
5861

5962
- Name
60-
- Cluster or Namespace scope
63+
- Cluster or namespaced scope
6164
- Endpoint URL and supported verbs
6265
- Alternative names
6366
- Group, version, kind
@@ -68,22 +71,25 @@ separate endpoint for each group version.
6871

6972
### Aggregated Discovery
7073

71-
{{< feature-state state="beta" for_k8s_version="v1.27" >}}
74+
{{< feature-state state="beta" for_k8s_version="v1.27" >}}
7275

7376
Kubernetes offers beta support for aggregated discovery, publishing
7477
all resources supported by a cluster through two endpoints (`/api` and
7578
`/apis`). Requesting this
7679
endpoint drastically reduces the number of requests sent to fetch the
77-
discovery for the average Kubernetes cluster. This may be accessed by
78-
requesting the respective endpoints with an Accept header indicating
80+
discovery data from the cluster. You can access the data by
81+
requesting the respective endpoints with an `Accept` header indicating
7982
the aggregated discovery resource:
8083
`Accept: application/json;v=v2beta1;g=apidiscovery.k8s.io;as=APIGroupDiscoveryList`.
8184

82-
Without the Accept header resource type explicitly indicated, the default
85+
Without indicating the resource type using the `Accept` header, the default
8386
response for the `/api` and `/apis` endpoint is an unaggregated discovery
8487
document.
8588

86-
The [discovery document](https://github.com/kubernetes/kubernetes/blob/release-v{{< skew currentVersion >}}/api/discovery/aggregated_v2beta1.json) serving built-in resources is found in the Kubernetes Github repository. This Github document can be used as a reference of the base set of available resources if a Kubernetes cluster is not available to query.
89+
The [discovery document](https://github.com/kubernetes/kubernetes/blob/release-v{{< skew currentVersion >}}/api/discovery/aggregated_v2beta1.json)
90+
for the built-in resources can be found in the Kubernetes GitHub repository.
91+
This Github document can be used as a reference of the base set of the available resources
92+
if a Kubernetes cluster is not available to query.
8793

8894
The endpoint also supports ETag and protobuf encoding.
8995

@@ -254,16 +260,18 @@ Refer to the table below for accepted request headers.
254260
</tbody>
255261
</table>
256262

257-
A Golang implementation to fetch the OpenAPI V3 is provided in the package [`k8s.io/client-go/openapi3`](https://pkg.go.dev/k8s.io/client-go/openapi3).
263+
A Golang implementation to fetch the OpenAPI V3 is provided in the package
264+
[`k8s.io/client-go/openapi3`](https://pkg.go.dev/k8s.io/client-go/openapi3).
258265

259-
Kubernetes {{< skew currentVersion >}} publishes
266+
Kubernetes {{< skew currentVersion >}} publishes
260267
OpenAPI v2.0 and v3.0; there are no plans to support 3.1 in the near future.
261268

262269
### Protobuf serialization
263270

264271
Kubernetes implements an alternative Protobuf based serialization format that
265272
is primarily intended for intra-cluster communication. For more information
266-
about this format, see the [Kubernetes Protobuf serialization](https://git.k8s.io/design-proposals-archive/api-machinery/protobuf.md) design proposal and the
273+
about this format, see the [Kubernetes Protobuf serialization](https://git.k8s.io/design-proposals-archive/api-machinery/protobuf.md)
274+
design proposal and the
267275
Interface Definition Language (IDL) files for each schema located in the Go
268276
packages that define the API objects.
269277

0 commit comments

Comments
 (0)