Skip to content

Commit 2e42994

Browse files
authored
Document APIResponseCompression feature gate (#41318)
* Document APIResponseCompression feature gate * Modify APIResponseCompression definition * Document APIResponseCompression feature gate Modify APIResponseCompression definition Minor edits to streamline paragraphs
1 parent 533a08b commit 2e42994

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

content/en/docs/reference/using-api/api-concepts.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,36 @@ Content-Type: application/json
284284
<followed by regular watch stream starting from resourceVersion="10245">
285285
```
286286

287+
## Response compression
288+
289+
{{< feature-state for_k8s_version="v1.16" state="beta" >}}
290+
291+
`APIResponseCompression` is an option that allows the API server to compress the responses for **get**
292+
and **list** requests, reducing the network bandwidth and improving the performance of large-scale clusters.
293+
It is enabled by default since Kubernetes 1.16 and it can be disabled by including
294+
`APIResponseCompression=false` in the `--feature-gates` flag on the API server.
295+
296+
API response compression can significantly reduce the size of the response, especially for large resources or
297+
[collections](/docs/reference/using-api/api-concepts/#collections).
298+
For example, a **list** request for pods can return hundreds of kilobytes or even megabytes of data,
299+
depending on the number of pods and their attributes. By compressing the response, the network bandwidth
300+
can be saved and the latency can be reduced.
301+
302+
To verify if `APIResponseCompression` is working, you can send a **get** or **list** request to the
303+
API server with an `Accept-Encoding` header, and check the response size and headers. For example:
304+
305+
```console
306+
GET /api/v1/pods
307+
Accept-Encoding: gzip
308+
---
309+
200 OK
310+
Content-Type: application/json
311+
content-encoding: gzip
312+
...
313+
```
314+
315+
The `content-encoding` header indicates that the response is compressed with `gzip`.
316+
287317
## Retrieving large results sets in chunks
288318

289319
{{< feature-state for_k8s_version="v1.9" state="beta" >}}

0 commit comments

Comments
 (0)