@@ -68,11 +68,11 @@ Almost all object resource types support the standard HTTP verbs - GET, POST, PU
68
68
and DELETE. Kubernetes also uses its own verbs, which are often written in lowercase to distinguish
69
69
them from HTTP verbs.
70
70
71
- Kubernetes uses the term ** list** to describe returning a [ collection] ( #collections ) of
72
- resources to distinguish from retrieving a single resource which is usually called
71
+ Kubernetes uses the term ** list** to describe the action of returning a [ collection] ( #collections ) of
72
+ resources, to distinguish it from retrieving a single resource which is usually called
73
73
a ** get** . If you sent an HTTP GET request with the ` ?watch ` query parameter,
74
- Kubernetes calls this a ** watch** and not a ** get** (see
75
- [ Efficient detection of changes] ( #efficient-detection-of-changes ) for more details).
74
+ Kubernetes calls this a ** watch** and not a ** get**
75
+ (see [ Efficient detection of changes] ( #efficient-detection-of-changes ) for more details).
76
76
77
77
For PUT requests, Kubernetes internally classifies these as either ** create** or ** update**
78
78
based on the state of the existing object. An ** update** is different from a ** patch** ; the
@@ -335,17 +335,16 @@ Accept: application/vnd.kubernetes.protobuf, application/json
335
335
336
336
{{< feature-state feature_gate_name="CBORServingAndStorage" >}}
337
337
338
- With the ` CBORServingAndStorage ` [ feature
339
- gate] ( /docs/reference/command-line-tools-reference/feature-gates/ ) enabled, request and response
340
- bodies for all built-in resource types and all resources defined by a {{< glossary_tooltip
341
- term_id="CustomResourceDefinition" text="CustomResourceDefinition" >}} may be encoded to the
342
- [ CBOR] ( https://www.rfc-editor.org/rfc/rfc8949 ) binary data format. CBOR is also supported at the {{<
343
- glossary_tooltip text="aggregation layer" term_id="aggregation-layer" >}} if it is enabled in
338
+ With the ` CBORServingAndStorage ` [ feature gate] ( /docs/reference/command-line-tools-reference/feature-gates/ )
339
+ enabled, request and response bodies for all built-in resource types and all resources defined by a
340
+ {{< glossary_tooltip term_id="CustomResourceDefinition" text="CustomResourceDefinition" >}} may be encoded to the
341
+ [ CBOR] ( https://www.rfc-editor.org/rfc/rfc8949 ) binary data format. CBOR is also supported at the
342
+ {{< glossary_tooltip text="aggregation layer" term_id="aggregation-layer" >}} if it is enabled in
344
343
individual aggregated API servers.
345
344
346
345
Clients should indicate the IANA media type ` application/cbor ` in the ` Content-Type ` HTTP request
347
- header when the request body contains a single CBOR [ encoded data
348
- item] ( https://www.rfc-editor.org/rfc/rfc8949.html#section-1.2-4.2 ) , and in the ` Accept ` HTTP request
346
+ header when the request body contains a single CBOR
347
+ [ encoded data item] ( https://www.rfc-editor.org/rfc/rfc8949.html#section-1.2-4.2 ) , and in the ` Accept ` HTTP request
349
348
header when prepared to accept a CBOR encoded data item in the response. API servers will use
350
349
` application/cbor ` in the ` Content-Type ` HTTP response header when the response body contains a
351
350
CBOR-encoded object.
@@ -355,8 +354,8 @@ CBOR, the response body will be a [CBOR Sequence](https://www.rfc-editor.org/rfc
355
354
` Content-Type ` HTTP response header will use the IANA media type ` application/cbor-seq ` . Each entry
356
355
of the sequence (if any) is a single CBOR-encoded watch event.
357
356
358
- In addition to the existing ` application/apply-patch+yaml ` media type for YAML-encoded [ server-side
359
- apply configurations] ( #patch-and-apply ) , API servers that enable CBOR will accept the
357
+ In addition to the existing ` application/apply-patch+yaml ` media type for YAML-encoded
358
+ [ server-side apply configurations] ( #patch-and-apply ) , API servers that enable CBOR will accept the
360
359
` application/apply-patch+cbor ` media type for CBOR-encoded server-side apply configurations. There
361
360
is no supported CBOR equivalent for ` application/json-patch+json ` or ` application/merge-patch+json ` ,
362
361
or ` application/strategic-merge-patch+json ` .
@@ -388,7 +387,7 @@ For example:
388
387
389
388
1 . List all of the pods in a given namespace.
390
389
391
- ```
390
+ ``` http
392
391
GET /api/v1/namespaces/test/pods
393
392
---
394
393
200 OK
@@ -407,7 +406,7 @@ For example:
407
406
_ test_ namespace. Each change notification is a JSON document. The HTTP response body
408
407
(served as ` application/json ` ) consists a series of JSON documents.
409
408
410
- ```
409
+ ``` http
411
410
GET /api/v1/namespaces/test/pods?watch=1&resourceVersion=10245
412
411
---
413
412
200 OK
@@ -444,7 +443,7 @@ to a given `resourceVersion` the client is requesting have already been sent. Th
444
443
document representing the ` BOOKMARK ` event is of the type requested by the request,
445
444
but only includes a ` .metadata.resourceVersion ` field. For example:
446
445
447
- ```
446
+ ``` http
448
447
GET /api/v1/namespaces/test/pods?watch=1&resourceVersion=10245&allowWatchBookmarks=true
449
448
---
450
449
200 OK
@@ -474,7 +473,7 @@ the API server will send any `BOOKMARK` event even when requested.
474
473
On large clusters, retrieving the collection of some resource types may result in
475
474
a significant increase of resource usage (primarily RAM) on the control plane.
476
475
To alleviate the impact and simplify the user experience of the ** list** + ** watch**
477
- pattern, Kubernetes v1.32 promotes to beta the feature that allows requesting the initial state
476
+ pattern, Kubernetes v1.32 promotes to beta the feature that allows requesting the initial state
478
477
(previously requested via the ** list** request) as part of the ** watch** request.
479
478
480
479
On the client-side the initial state can be requested by specifying ` sendInitialEvents=true ` as query string parameter
@@ -500,7 +499,7 @@ is 10245 and there are two pods: `foo` and `bar`. Then sending the following req
500
499
_ consistent read_ by setting empty resource version using ` resourceVersion= ` ) could result
501
500
in the following sequence of events:
502
501
503
- ```
502
+ ``` http
504
503
GET /api/v1/namespaces/test/pods?watch=1&sendInitialEvents=true&allowWatchBookmarks=true&resourceVersion=&resourceVersionMatch=NotOlderThan
505
504
---
506
505
200 OK
@@ -541,7 +540,7 @@ can be saved and the latency can be reduced.
541
540
To verify if ` APIResponseCompression ` is working, you can send a ** get** or ** list** request to the
542
541
API server with an ` Accept-Encoding ` header, and check the response size and headers. For example:
543
542
544
- ```
543
+ ``` http
545
544
GET /api/v1/pods
546
545
Accept-Encoding: gzip
547
546
---
@@ -592,7 +591,7 @@ of 500 pods at a time, request those chunks as follows:
592
591
593
592
1 . List all of the pods on a cluster, retrieving up to 500 pods each time.
594
593
595
- ```
594
+ ``` http
596
595
GET /api/v1/pods?limit=500
597
596
---
598
597
200 OK
@@ -613,7 +612,7 @@ of 500 pods at a time, request those chunks as follows:
613
612
614
613
1 . Continue the previous call, retrieving the next set of 500 pods.
615
614
616
- ```
615
+ ``` http
617
616
GET /api/v1/pods?limit=500&continue=ENCODED_CONTINUE_TOKEN
618
617
---
619
618
200 OK
@@ -634,7 +633,7 @@ of 500 pods at a time, request those chunks as follows:
634
633
635
634
1 . Continue the previous call, retrieving the last 253 pods.
636
635
637
- ```
636
+ ``` http
638
637
GET /api/v1/pods?limit=500&continue=ENCODED_CONTINUE_TOKEN_2
639
638
---
640
639
200 OK
@@ -655,7 +654,7 @@ of 500 pods at a time, request those chunks as follows:
655
654
Notice that the ` resourceVersion ` of the collection remains constant across each request,
656
655
indicating the server is showing you a consistent snapshot of the pods. Pods that
657
656
are created, updated, or deleted after version ` 10245 ` would not be shown unless
658
- you make a separate ** list** request without the ` continue ` token. This allows you
657
+ you make a separate ** list** request without the ` continue ` token. This allows you
659
658
to break large requests into smaller chunks and then perform a ** watch** operation
660
659
on the full set without missing any updates.
661
660
@@ -682,7 +681,7 @@ has `kind` set to
682
681
[ ` ServiceList ` ] ( /docs/reference/kubernetes-api/service-resources/service-v1/#ServiceList ) ;
683
682
each item in that collection represents a single Service. For example:
684
683
685
- ```
684
+ ``` http
686
685
GET /api/v1/services
687
686
```
688
687
@@ -779,7 +778,7 @@ type.
779
778
780
779
For example, list all of the pods on a cluster in the Table format.
781
780
782
- ```
781
+ ` ` ` http
783
782
GET /api/v1/pods
784
783
Accept: application/json;as=Table;g=meta.k8s.io;v=v1
785
784
---
@@ -800,7 +799,7 @@ For API resource types that do not have a custom Table definition known to the c
800
799
plane, the API server returns a default Table response that consists of the resource's
801
800
` name` and `creationTimestamp` fields.
802
801
803
- ```
802
+ ` ` ` http
804
803
GET /apis/crd.example.com/v1alpha1/namespaces/default/resources
805
804
---
806
805
200 OK
@@ -844,7 +843,7 @@ Accept: application/json;as=Table;g=meta.k8s.io;v=v1, application/json
844
843
When you **delete** a resource this takes place in two phases.
845
844
846
845
1. _finalization_
847
- 2 . removal
846
+ 1 . removal
848
847
849
848
` ` ` yaml
850
849
{
@@ -857,7 +856,8 @@ When you **delete** a resource this takes place in two phases.
857
856
}
858
857
` ` `
859
858
860
- When a client first sends a ** delete** to request the removal of a resource, the ` .metadata.deletionTimestamp ` is set to the current time.
859
+ When a client first sends a **delete** to request the removal of a resource,
860
+ the `.metadata.deletionTimestamp` is set to the current time.
861
861
Once the `.metadata.deletionTimestamp` is set, external controllers that act on finalizers
862
862
may start performing their cleanup work at any time, in any order.
863
863
@@ -896,8 +896,12 @@ the **delete** and **unsafe-delete-ignore-read-errors** verbs on the given resou
896
896
{{< /note >}}
897
897
898
898
A resource is considered corrupt if it can not be successfully retrieved from the
899
- storage due to a) transformation error (for example: decryption failure), or b) the object
900
- failed to decode. The API server first attempts a normal deletion, and if it fails with
899
+ storage due to :
900
+
901
+ - transformation error (for example : decryption failure), or
902
+ - the object failed to decode.
903
+
904
+ The API server first attempts a normal deletion, and if it fails with
901
905
a _corrupt resource_ error then it triggers the force delete. A force **delete** operation
902
906
is unsafe because it ignores finalizer constraints, and skips precondition checks.
903
907
@@ -944,18 +948,17 @@ an HTTP request.
944
948
These situations are :
945
949
946
950
1. The field is unrecognized because it is not in the resource's OpenAPI schema. (One
947
- exception to this is for {{< glossary_tooltip
948
- term_id="CustomResourceDefinition" text="CRDs" >}} that explicitly choose not to prune unknown
949
- fields via ` x-kubernetes-preserve-unknown-fields ` ).
951
+ exception to this is for {{< glossary_tooltip term_id="CustomResourceDefinition" text="CRDs" >}}
952
+ that explicitly choose not to prune unknown fields via `x-kubernetes-preserve-unknown-fields`).
950
953
1. The field is duplicated in the object.
951
954
952
955
# ## Validation for unrecognized or duplicate fields {#setting-the-field-validation-level}
953
956
954
957
{{< feature-state feature_gate_name="ServerSideFieldValidation" >}}
955
958
956
959
From 1.25 onward, unrecognized or duplicate fields in an object are detected via
957
- validation on the server when you use HTTP verbs that can submit data (` POST ` , ` PUT ` , and ` PATCH ` ). Possible levels of
958
- validation are ` Ignore ` , ` Warn ` (default), and ` Strict ` .
960
+ validation on the server when you use HTTP verbs that can submit data (`POST`, `PUT`, and `PATCH`).
961
+ Possible levels of validation are `Ignore`, `Warn` (default), and `Strict`.
959
962
960
963
` Ignore`
961
964
: The API server succeeds in handling the request as it would without the erroneous fields
@@ -1003,7 +1006,7 @@ Client-side validation will be removed entirely in a future version of kubectl.
1003
1006
1004
1007
{{< note >}}
1005
1008
1006
- Prior to Kubernetes 1.25 ` kubectl --validate ` was used to toggle client-side validation on or off as
1009
+ Prior to Kubernetes 1.25, `kubectl --validate` was used to toggle client-side validation on or off as
1007
1010
a boolean flag.
1008
1011
1009
1012
{{< /note >}}
@@ -1056,7 +1059,7 @@ effects on any request marked as dry runs.
1056
1059
1057
1060
Here is an example dry-run request that uses `?dryRun=All` :
1058
1061
1059
- ```
1062
+ ` ` ` http
1060
1063
POST /api/v1/namespaces/test/pods?dryRun=All
1061
1064
Content-Type: application/json
1062
1065
Accept: application/json
@@ -1127,14 +1130,14 @@ corresponding HTTP `Content-Type` header:
1127
1130
: Server Side Apply YAML (a Kubernetes-specific extension, based on YAML).
1128
1131
All JSON documents are valid YAML, so you can also submit JSON using this
1129
1132
media type. See [Server Side Apply serialization](/docs/reference/using-api/server-side-apply/#serialization)
1130
- for more details.
1133
+ for more details.
1131
1134
To Kubernetes, this is a **create** operation if the object does not exist,
1132
1135
or a **patch** operation if the object already exists.
1133
1136
1134
1137
` application/json-patch+json`
1135
1138
: JSON Patch, as defined in [RFC6902](https://tools.ietf.org/html/rfc6902).
1136
1139
A JSON patch is a sequence of operations that are executed on the resource;
1137
- for example `{"op" : " add" , "path": "/a/b/c", "value": [ "foo", "bar" ]}`.
1140
+ for example `{"op" : " add" , "path": "/a/b/c", "value": [ "foo", "bar" ]}`.
1138
1141
To Kubernetes, this is a **patch** operation.
1139
1142
1140
1143
A **patch** using `application/json-patch+json` can include conditions to
@@ -1145,7 +1148,7 @@ corresponding HTTP `Content-Type` header:
1145
1148
: JSON Merge Patch, as defined in [RFC7386](https://tools.ietf.org/html/rfc7386).
1146
1149
A JSON Merge Patch is essentially a partial representation of the resource.
1147
1150
The submitted JSON is combined with the current resource to create a new one,
1148
- then the new one is saved.
1151
+ then the new one is saved.
1149
1152
To Kubernetes, this is a **patch** operation.
1150
1153
1151
1154
` application/strategic-merge-patch+json`
@@ -1333,23 +1336,23 @@ Any
1333
1336
Most recent
1334
1337
: Return data at the most recent resource version. The returned data must be
1335
1338
consistent (in detail : served from etcd via a quorum read).
1336
- For etcd v3.4.31+ and v3.5.13+ Kubernetes {{< skew currentVersion >}} serves “most recent” reads from the _watch cache_ :
1339
+ For etcd v3.4.31+ and v3.5.13+, Kubernetes {{< skew currentVersion >}} serves “most recent” reads from the _watch cache_ :
1337
1340
an internal, in-memory store within the API server that caches and mirrors the state of data
1338
1341
persisted into etcd. Kubernetes requests progress notification to maintain cache consistency against
1339
- the etcd persistence layer. Kubernetes versions v1.28 through to v1.30 also supported this
1342
+ the etcd persistence layer. Kubernetes v1.28 through to v1.30 also supported this
1340
1343
feature, although as Alpha it was not recommended for production nor enabled by default until the v1.31 release.
1341
1344
1342
1345
Not older than
1343
1346
: Return data at least as new as the provided `resourceVersion`. The newest
1344
1347
available data is preferred, but any data not older than the provided `resourceVersion` may be
1345
- served. For **list** requests to servers that honor the `resourceVersionMatch` parameter, this
1348
+ served. For **list** requests to servers that honor the `resourceVersionMatch` parameter, this
1346
1349
guarantees that the collection's `.metadata.resourceVersion` is not older than the requested
1347
1350
` resourceVersion` , but does not make any guarantee about the `.metadata.resourceVersion` of any
1348
1351
of the items in that collection.
1349
1352
1350
1353
Exact
1351
1354
: Return data at the exact resource version provided. If the provided `resourceVersion` is
1352
- unavailable, the server responds with HTTP 410 " Gone". For **list** requests to servers that honor the
1355
+ unavailable, the server responds with HTTP ` 410 Gone`. For **list** requests to servers that honor the
1353
1356
` resourceVersionMatch` parameter, this guarantees that the collection's `.metadata.resourceVersion`
1354
1357
is the same as the `resourceVersion` you requested in the query string. That guarantee does
1355
1358
not apply to the `.metadata.resourceVersion` of any items within that collection.
@@ -1370,7 +1373,7 @@ the object is when served.
1370
1373
{{< /note >}}
1371
1374
1372
1375
When using `resourceVersionMatch=NotOlderThan` and limit is set, clients must
1373
- handle HTTP 410 " Gone" responses. For example, the client might retry with a
1376
+ handle HTTP ` 410 Gone` responses. For example, the client might retry with a
1374
1377
newer `resourceVersion` or fall back to `resourceVersion=""`.
1375
1378
1376
1379
When using `resourceVersionMatch=Exact` and `limit` is unset, clients must
@@ -1395,11 +1398,7 @@ For **watch**, the semantics of resource version are:
1395
1398
The meaning of those **watch** semantics are :
1396
1399
1397
1400
Get State and Start at Any
1398
- : {{< caution >}} Watches initialized this way may return arbitrarily stale
1399
- data. Please review this semantic before using it, and favor the other semantics
1400
- where possible.
1401
- {{< /caution >}}
1402
- Start a **watch** at any resource version; the most recent resource version
1401
+ : Start a **watch** at any resource version; the most recent resource version
1403
1402
available is preferred, but not required. Any starting resource version is
1404
1403
allowed. It is possible for the **watch** to start at a much older resource
1405
1404
version that the client has previously observed, particularly in high availability
@@ -1410,6 +1409,12 @@ Get State and Start at Any
1410
1409
watch events are for all changes that occurred after the resource version the
1411
1410
**watch** started at.
1412
1411
1412
+ {{< caution >}}
1413
+ **watches** initialized this way may return arbitrarily stale
1414
+ data. Please review this semantic before using it, and favor the other semantics
1415
+ where possible.
1416
+ {{< /caution >}}
1417
+
1413
1418
Get State and Start at Most Recent
1414
1419
: Start a **watch** at the most recent resource version, which must be consistent
1415
1420
(in detail : served from etcd via a quorum read). To establish initial state,
@@ -1450,8 +1455,8 @@ then the API server may either:
1450
1455
should wait before retrying the request.
1451
1456
1452
1457
If you request a resource version that an API server does not recognize, the
1453
- kube-apiserver additionally identifies its error responses with a "Too large resource
1454
- version" message .
1458
+ kube-apiserver additionally identifies its error responses with a message
1459
+ ` Too large resource version ` .
1455
1460
1456
1461
If you make a **watch** request for an unrecognized resource version, the API server
1457
1462
may wait indefinitely (until the request timeout) for the resource version to become
0 commit comments