From 41547099c4a76d558bdbf07507ec192913590007 Mon Sep 17 00:00:00 2001 From: Jefftree Date: Tue, 23 Nov 2021 14:14:36 -0800 Subject: [PATCH] Add section for OpenAPI v3 --- .../docs/concepts/overview/kubernetes-api.md | 56 ++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/content/en/docs/concepts/overview/kubernetes-api.md b/content/en/docs/concepts/overview/kubernetes-api.md index 07b5d559d7..e1ddda4267 100644 --- a/content/en/docs/concepts/overview/kubernetes-api.md +++ b/content/en/docs/concepts/overview/kubernetes-api.md @@ -37,8 +37,11 @@ if you are writing an application using the Kubernetes API. Complete API details are documented using [OpenAPI](https://www.openapis.org/). -The Kubernetes API server serves an OpenAPI spec via the `/openapi/v2` endpoint. -You can request the response format using request headers as follows: +### OpenAPI V2 + +The Kubernetes API server serves an aggregated OpenAPI v2 spec via the +`/openapi/v2` endpoint. You can request the response format using +request headers as follows: @@ -77,6 +80,55 @@ about this format, see the [Kubernetes Protobuf serialization](https://github.co Interface Definition Language (IDL) files for each schema located in the Go packages that define the API objects. +### OpenAPI V3 + +{{< feature-state state="alpha" for_k8s_version="v1.23" >}} + +Kubernetes v1.23 offers initial support for publishing its APIs as OpenAPI v3; this is an +alpha feature that is disabled by default. +You can enable the alpha feature by turning on the +[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) named `OpenAPIV3` +for the kube-apiserver component. + +With the feature enabled, the Kubernetes API server serves an +aggregated OpenAPI v3 spec per Kubernetes group version at the +`/openapi/v3/apis//` endpoint. Please refer to the +table below for accepted request headers. + +
Valid request header values for OpenAPI v2 queries
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Valid request header values for OpenAPI v3 queries
HeaderPossible valuesNotes
Accept-Encodinggzipnot supplying this header is also acceptable
Acceptapplication/com.github.proto-openapi.spec.v3@v1.0+protobufmainly for intra-cluster use
application/jsondefault
*serves application/json
+ +A discovery endpoint `/openapi/v3` is provided to see a list of all +group/versions available. This endpoint only returns JSON. + ## Persistence Kubernetes stores the serialized state of objects by writing them into