You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Without indicating the resource type using the `Accept` header, the default
86
+
response for the `/api` and `/apis` endpoint is an unaggregated discovery
87
+
document.
88
+
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.
93
+
94
+
The endpoint also supports ETag and protobuf encoding.
95
+
96
+
### Unaggregated discovery
97
+
98
+
Without discovery aggregation, discovery is published in levels, with the root
99
+
endpoints publishing discovery information for downstream documents.
100
+
101
+
A list of all group versions supported by a cluster is published at
102
+
the `/api` and `/apis` endpoints. Example:
103
+
104
+
```
105
+
{
106
+
"kind": "APIGroupList",
107
+
"apiVersion": "v1",
108
+
"groups": [
109
+
{
110
+
"name": "apiregistration.k8s.io",
111
+
"versions": [
112
+
{
113
+
"groupVersion": "apiregistration.k8s.io/v1",
114
+
"version": "v1"
115
+
}
116
+
],
117
+
"preferredVersion": {
118
+
"groupVersion": "apiregistration.k8s.io/v1",
119
+
"version": "v1"
120
+
}
121
+
},
122
+
{
123
+
"name": "apps",
124
+
"versions": [
125
+
{
126
+
"groupVersion": "apps/v1",
127
+
"version": "v1"
128
+
}
129
+
],
130
+
"preferredVersion": {
131
+
"groupVersion": "apps/v1",
132
+
"version": "v1"
133
+
}
134
+
},
135
+
...
136
+
}
137
+
```
138
+
139
+
Additional requests are needed to obtain the discovery document for each group version at
140
+
`/apis/<group>/<version>` (for example:
141
+
`/apis/rbac.authorization.k8s.io/v1alpha1`), which advertises the list of
142
+
resources served under a particular group version. These endpoints are used by
143
+
kubectl to fetch the list of resources supported by a cluster.
33
144
34
145
<!-- body -->
35
146
36
-
## OpenAPI specification {#api-specification}
147
+
<aid="#api-specification" />
37
148
38
-
Complete API details are documented using [OpenAPI](https://www.openapis.org/).
149
+
## OpenAPI interface definition
39
150
151
+
For details about the OpenAPI specifications, see the [OpenAPI documentation](https://www.openapis.org/).
152
+
153
+
Kubernetes serves both OpenAPI v2.0 and OpenAPI v3.0. OpenAPI v3 is the
154
+
preferred method of accessing the OpenAPI because it offers a more comprehensive
155
+
(lossless) representation of Kubernetes resources. Due to limitations of OpenAPI
156
+
version 2, certain fields are dropped from the published OpenAPI including but not
157
+
limited to `default`, `nullable`, `oneOf`.
40
158
### OpenAPI V2
41
159
42
160
The Kubernetes API server serves an aggregated OpenAPI v2 spec via the
@@ -74,11 +192,6 @@ request headers as follows:
74
192
</tbody>
75
193
</table>
76
194
77
-
Kubernetes implements an alternative Protobuf based serialization format that
78
-
is primarily intended for intra-cluster communication. For more information
79
-
about this format, see the [Kubernetes Protobuf serialization](https://git.k8s.io/design-proposals-archive/api-machinery/protobuf.md) design proposal and the
80
-
Interface Definition Language (IDL) files for each schema located in the Go
81
-
packages that define the API objects.
82
195
83
196
### OpenAPI V3
84
197
@@ -149,7 +262,20 @@ Refer to the table below for accepted request headers.
149
262
</tbody>
150
263
</table>
151
264
152
-
A Golang implementation to fetch the OpenAPI V3 is provided in the package `k8s.io/client-go/openapi3`.
265
+
A Golang implementation to fetch the OpenAPI V3 is provided in the package
Copy file name to clipboardExpand all lines: content/en/docs/contribute/style/style-guide.md
+45-19Lines changed: 45 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,17 +116,20 @@ The copy is called a "fork". | The copy is called a "fork."
116
116
117
117
## Inline code formatting
118
118
119
-
### Use code style for inline code, commands, and API objects {#code-style-inline-code}
119
+
### Use code style for inline code, commands {#code-style-inline-code}
120
120
121
121
For inline code in an HTML document, use the `<code>` tag. In a Markdown
122
-
document, use the backtick (`` ` ``).
122
+
document, use the backtick (`` ` ``). However, API kinds such as StatefulSet
123
+
or ConfigMap are written verbatim (no backticks); this allows using possessive
124
+
apostrophes.
123
125
124
126
{{< table caption = "Do and Don't - Use code style for inline code, commands, and API objects" >}}
125
127
Do | Don't
126
128
:--| :-----
127
-
The `kubectl run` command creates a `Pod`. | The "kubectl run" command creates a pod.
128
-
The kubelet on each node acquires a `Lease`… | The kubelet on each node acquires a lease…
129
-
A `PersistentVolume` represents durable storage… | A Persistent Volume represents durable storage…
129
+
The `kubectl run` command creates a Pod. | The "kubectl run" command creates a Pod.
130
+
The kubelet on each node acquires a Lease… | The kubelet on each node acquires a `Lease`…
131
+
A PersistentVolume represents durable storage… | A `PersistentVolume` represents durable storage…
132
+
The CustomResourceDefinition's `.spec.group` field… | The `CustomResourceDefinition.spec.group` field…
130
133
For declarative management, use `kubectl apply`. | For declarative management, use "kubectl apply".
131
134
Enclose code samples with triple backticks. (\`\`\`)| Enclose code samples with any other syntax.
132
135
Use single backticks to enclose inline code. For example, `var example = true`. | Use two asterisks (`**`) or an underscore (`_`) to enclose inline code. For example, **var example = true**.
@@ -191,37 +194,60 @@ Set the value of `image` to nginx:1.16. | Set the value of `image` to `nginx:1.1
191
194
Set the value of the `replicas` field to 2. | Set the value of the `replicas` field to `2`.
192
195
{{< /table >}}
193
196
197
+
However, consider quoting values where there is a risk that readers might confuse the value
198
+
with an API kind.
199
+
194
200
## Referring to Kubernetes API resources
195
201
196
202
This section talks about how we reference API resources in the documentation.
197
203
198
204
### Clarification about "resource"
199
205
200
-
Kubernetes uses the word "resource" to refer to API resources, such as `pod`,
201
-
`deployment`, and so on. We also use "resource" to talk about CPU and memory
202
-
requests and limits. Always refer to API resources as "API resources" to avoid
203
-
confusion with CPU and memory resources.
206
+
Kubernetes uses the word _resource_ to refer to API resources. For example,
207
+
the URL path `/apis/apps/v1/namespaces/default/deployments/my-app` represents a
208
+
Deployment named "my-app" in the "default"
209
+
{{< glossary_tooltip text="namespace" term_id="namespace" >}}. In HTTP jargon,
210
+
{{< glossary_tooltip text="namespace" term_id="namespace" >}} is a resource -
211
+
the same way that all web URLs identify a resource.
212
+
213
+
Kubernetes documentation also uses "resource" to talk about CPU and memory
214
+
requests and limits. It's very often a good idea to refer to API resources
215
+
as "API resources"; that helps to avoid confusion with CPU and memory resources,
216
+
or with other kinds of resource.
217
+
218
+
If you are using the lowercase plural form of a resource name, such as
219
+
`deployments` or `configmaps`, provide extra written context to help readers
220
+
understand what you mean. If you are using the term in a context where the
221
+
UpperCamelCase name could work too, and there is a risk of ambiguity,
222
+
consider using the API kind in UpperCamelCase.
204
223
205
224
### When to use Kubernetes API terminologies
206
225
207
226
The different Kubernetes API terminologies are:
208
227
209
-
- Resource type: the name used in the API URL (such as `pods`, `namespaces`)
210
-
- Resource: a single instance of a resource type (such as `pod`, `secret`)
211
-
- Object: a resource that serves as a "record of intent". An object is a desired
228
+
-_API kinds_: the name used in the API URL (such as `pods`, `namespaces`).
229
+
API kinds are sometimes also called _resource types_.
230
+
-_API resource_: a single instance of an API kind (such as `pod`, `secret`).
231
+
-_Object_: a resource that serves as a "record of intent". An object is a desired
212
232
state for a specific part of your cluster, which the Kubernetes control plane tries to maintain.
233
+
All objects in the Kubernetes API are also resources.
213
234
214
-
Always use "resource" or "object" when referring to an API resource in docs.
215
-
For example, use "a `Secret` object" over just "a `Secret`".
235
+
For clarity, you can add "resource" or "object" when referring to an API resource in Kubernetes
236
+
documentation.
237
+
An example: write "a Secret object" instead of "a Secret".
238
+
If it is clear just from the capitalization, you don't need to add the extra word.
239
+
240
+
Consider rephrasing when that change helps avoid misunderstandings. A common situation is
241
+
when you want to start a sentence with an API kind, such as “Secret”; because English
242
+
and other languages capitalize at the start of sentences, readers cannot tell whether you
243
+
mean the API kind or the general concept. Rewording can help.
216
244
217
245
### API resource names
218
246
219
247
Always format API resource names using [UpperCamelCase](https://en.wikipedia.org/wiki/Camel_case),
220
-
also known as PascalCase, and code formatting.
221
-
222
-
For inline code in an HTML document, use the `<code>` tag. In a Markdown document, use the backtick (`` ` ``).
248
+
also known as PascalCase. Do not write API kinds with code formatting.
223
249
224
-
Don't split an API object name into separate words. For example, use `PodTemplateList`, not Pod Template List.
250
+
Don't split an API object name into separate words. For example, use PodTemplateList, not Pod Template List.
225
251
226
252
For more information about PascalCase and code formatting, please review the related guidance on
227
253
[Use upper camel case for API objects](/docs/contribute/style/style-guide/#use-upper-camel-case-for-api-objects)
@@ -237,7 +263,7 @@ guidance on [Kubernetes API terminology](/docs/reference/using-api/api-concepts/
237
263
{{< table caption = "Do and Don't - Don't include the command prompt" >}}
Copy file name to clipboardExpand all lines: content/en/docs/reference/using-api/cel.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,10 +55,12 @@ Example CEL expressions:
55
55
|`has(self.expired) && self.created + self.ttl < self.expired`| Validate that 'expired' date is after a 'create' date plus a 'ttl' duration |
56
56
|`self.health.startsWith('ok')`| Validate a 'health' string field has the prefix 'ok' |
57
57
|`self.widgets.exists(w, w.key == 'x' && w.foo < 10)`| Validate that the 'foo' property of a listMap item with a key 'x' is less than 10 |
58
-
|`type(self) == string ? self == '99%' : self == 42`| Validate an int-or-string field for both the int and string cases |
58
+
|`type(self) == string ? self == '99%' : self == 42`| Validate an int-or-string field for both the int and string cases |
59
59
|`self.metadata.name == 'singleton'`| Validate that an object's name matches a specific value (making it a singleton) |
60
60
|`self.set1.all(e, !(e in self.set2))`| Validate that two listSets are disjoint |
61
61
|`self.names.size() == self.details.size() && self.names.all(n, n in self.details)`| Validate the 'details' map is keyed by the items in the 'names' listSet |
62
+
|`self.details.all(key, key.matches('^[a-zA-Z]*$')`| Validate the keys of the 'details' map |
63
+
|`self.details.all(key, self.details[key].matches('^[a-zA-Z]*$')`| Validate the values of the 'details' map |
Copy file name to clipboardExpand all lines: content/en/docs/tutorials/kubernetes-basics/update/update-intro.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -133,7 +133,7 @@ <h3>Update the version of the app</h3>
133
133
and look for the <code>Image</code> field:</p>
134
134
<p><code><b>kubectl describe pods</b></code></p>
135
135
<p>To update the image of the application to version 2, use the <code>set image</code> subcommand, followed by the deployment name and the new image version:</p>
136
-
<p><code><b>kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2</b></code></p>
136
+
<p><code><b>kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=docker.io/jocatalin/kubernetes-bootcamp:v2</b></code></p>
137
137
<p>The command notified the Deployment to use a different image for your app and initiated a rolling update. Check the status of the new Pods, and view the old one terminating with the <code>get pods</code> subcommand:</p>
0 commit comments