11
11
- [ Non-Goals] ( #non-goals )
12
12
- [ Anti-Goals] ( #anti-goals )
13
13
- [ Proposal] ( #proposal )
14
- - [ X- Kubectl-Command Header] ( #x- kubectl-command-header )
15
- - [ X- Kubectl-Flags Header] ( #x- kubectl-flags-header )
14
+ - [ Kubectl-Command Header] ( #kubectl-command-header )
15
+ - [ Kubectl-Flags Header] ( #kubectl-flags-header )
16
16
- [ Enumerated Flag Values] ( #enumerated-flag-values )
17
- - [ X- Kubectl-Session Header] ( #x- kubectl-session-header )
18
- - [ X- Kubectl-Deprecated Header] ( #x- kubectl-deprecated-header )
19
- - [ X- Kubectl-Build Header] ( #x- kubectl-build-header )
17
+ - [ Kubectl-Session Header] ( #kubectl-session-header )
18
+ - [ Kubectl-Deprecated Header] ( #kubectl-deprecated-header )
19
+ - [ Kubectl-Build Header] ( #kubectl-build-header )
20
20
- [ Example] ( #example )
21
21
- [ Risks and Mitigations] ( #risks-and-mitigations )
22
22
- [ Design Details] ( #design-details )
@@ -44,7 +44,7 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
44
44
- [X] (R) Graduation criteria is in place
45
45
- [X] (R) Production readiness review completed
46
46
- [X] (R) Production readiness review approved
47
- - [ ] "Implementation History" section is up-to-date for milestone
47
+ - [X ] "Implementation History" section is up-to-date for milestone
48
48
- [ ] User-facing documentation has been created in [ kubernetes/website] , for publication to [ kubernetes.io]
49
49
- [ ] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes
50
50
@@ -123,23 +123,23 @@ Include in http requests made from kubectl to the apiserver:
123
123
- if the command is deprecated, add a header including when which release it will be removed in (if known)
124
124
- allow users and organizations that compile their own kubectl binaries to define a build metadata header
125
125
126
- ### X- Kubectl-Command Header
126
+ ### Kubectl-Command Header
127
127
128
- The ` X- Kubectl-Command` Header contains the kubectl sub command.
128
+ The ` Kubectl-Command ` Header contains the kubectl sub command.
129
129
130
130
It contains the path to the subcommand (e.g. ` create secret tls ` ) to disambiguate sub commands
131
131
that might have the same name and different paths.
132
132
133
133
Examples:
134
134
135
- - ` X- Kubectl-Command: apply`
136
- - ` X- Kubectl-Command: create secret tls`
137
- - ` X- Kubectl-Command: delete`
138
- - ` X- Kubectl-Command: get`
135
+ - ` Kubectl-Command: kubectl apply `
136
+ - ` Kubectl-Command: kubectl create secret tls `
137
+ - ` Kubectl-Command: kubectl delete `
138
+ - ` Kubectl-Command: kubectl get `
139
139
140
- ### X- Kubectl-Flags Header
140
+ ### Kubectl-Flags Header
141
141
142
- The ` X- Kubectl-Flags` Header contains a list of the kubectl flags that were provided to the sub
142
+ The ` Kubectl-Flags ` Header contains a list of the kubectl flags that were provided to the sub
143
143
command. It does * not* contain the raw flag values, but may contain enumerations for
144
144
whitelisted flag values. (e.g. for ` -f ` it may contain whether a local file, stdin, or remote file
145
145
was provided). It does not normalize into short or long form. If a flag is
@@ -148,49 +148,49 @@ alpha-numerically and separated by a ',' to simplify human readability.
148
148
149
149
Examples:
150
150
151
- - ` X- Kubectl-Flags: --filename=local,--recursive,--context`
152
- - ` X- Kubectl-Flags: -f=local,-f=local,-f=remote,-R`
153
- - ` X- Kubectl-Flags: -f=stdin`
154
- - ` X- Kubectl-Flags: --dry-run,-o=custom-columns`
151
+ - ` Kubectl-Flags: --filename=local,--recursive,--context `
152
+ - ` Kubectl-Flags: -f=local,-f=local,-f=remote,-R `
153
+ - ` Kubectl-Flags: -f=stdin `
154
+ - ` Kubectl-Flags: --dry-run,-o=custom-columns `
155
155
156
156
#### Enumerated Flag Values
157
157
158
158
- ` -f ` , ` --filename ` : ` local ` , ` remote ` , ` stdin `
159
159
- ` -o ` , ` --output ` : ` json ` ,` yaml ` ,` wide ` ,` name ` ,` custom-columns ` ,` custom-columns-file ` ,` go-template ` ,` go-template-file ` ,` jsonpath ` ,` jsonpath-file `
160
160
- ` --type ` (for patch subcommand): ` json ` , ` merge ` , ` strategic `
161
161
162
- ### X- Kubectl-Session Header
162
+ ### Kubectl-Session Header
163
163
164
- The ` X- Kubectl-Session` Header contains a Session ID that can be used to identify that multiple
164
+ The ` Kubectl-Session ` Header contains a Session ID that can be used to identify that multiple
165
165
requests which were made from the same kubectl command invocation. The Session Header is generated
166
166
once and used for all requests for each kubectl process.
167
167
168
- - ` X- Kubectl-Session: 67b540bf-d219-4868-abd8-b08c77fefeca`
168
+ - ` Kubectl-Session: 67b540bf-d219-4868-abd8-b08c77fefeca `
169
169
170
- ### X- Kubectl-Deprecated Header
170
+ ### Kubectl-Deprecated Header
171
171
172
- The ` X- Kubectl-Deprecated` Header is set to inform cluster admins that the command being run
172
+ The ` Kubectl-Deprecated ` Header is set to inform cluster admins that the command being run
173
173
has been deprecated. This may be used by organizations to determine if they are likely
174
174
to be impacted by command deprecation and removal before they upgrade.
175
175
176
- The ` X- Kubectl-Deprecated` Header is set if the command that was run is marked as deprecated.
176
+ The ` Kubectl-Deprecated ` Header is set if the command that was run is marked as deprecated.
177
177
178
178
- The Header may have a value of ` true ` if the command has been deprecated, but has no removal date.
179
179
- The Header may have a value of a specific Kubernetes release. If it does, this is the release
180
180
that the command will be removed in.
181
181
182
- - ` X- Kubectl-Deprecated: true`
183
- - ` X- Kubectl-Deprecated: v1.16`
182
+ - ` Kubectl-Deprecated: true `
183
+ - ` Kubectl-Deprecated: v1.16 `
184
184
185
185
186
- ### X- Kubectl-Build Header
186
+ ### Kubectl-Build Header
187
187
188
- The ` X- Kubectl-Build` Header may be set by building with a specific ` -ldflags ` value. By default the Header
188
+ The ` Kubectl-Build ` Header may be set by building with a specific ` -ldflags ` value. By default the Header
189
189
is unset, but may be set if kubectl is built from source, forked, or vendored into another command.
190
190
Organizations that distribute one or more versions of kubectl which they maintain internally may
191
191
set a flag at build time and this header will be populated with the value.
192
192
193
- - ` X- Kubectl-Build: some-value`
193
+ - ` Kubectl-Build: some-value `
194
194
195
195
### Example
196
196
@@ -199,9 +199,9 @@ $ kubectl apply -f - -o yaml
199
199
```
200
200
201
201
```
202
- X- Kubectl-Command: apply
203
- X- Kubectl-Flags: -f=stdin,-o=yaml
204
- X- Kubectl-Session: 67b540bf-d219-4868-abd8-b08c77fefeca
202
+ Kubectl-Command: apply
203
+ Kubectl-Flags: -f=stdin,-o=yaml
204
+ Kubectl-Session: 67b540bf-d219-4868-abd8-b08c77fefeca
205
205
```
206
206
207
207
@@ -210,9 +210,9 @@ $ kubectl apply -f ./local/file -o=custom-columns=NAME:.metadata.name
210
210
```
211
211
212
212
```
213
- X- Kubectl-Command: apply
214
- X- Kubectl-Flags: -f=local,-o=custom-columns
215
- X- Kubectl-Session: 0087f200-3079-458e-ae9a-b35305fb7432
213
+ Kubectl-Command: apply
214
+ Kubectl-Flags: -f=local,-o=custom-columns
215
+ Kubectl-Session: 0087f200-3079-458e-ae9a-b35305fb7432
216
216
```
217
217
218
218
``` sh
@@ -221,9 +221,9 @@ image"}]'
221
221
```
222
222
223
223
```
224
- X- Kubectl-Command: patch
225
- X- Kubectl-Flags: --type=json,-p
226
- X- Kubectl-Session: 0087f200-3079-458e-ae9a-b35305fb7432
224
+ Kubectl-Command: patch
225
+ Kubectl-Flags: --type=json,-p
226
+ Kubectl-Session: 0087f200-3079-458e-ae9a-b35305fb7432
227
227
```
228
228
229
229
@@ -232,10 +232,10 @@ kubectl run nginx --image nginx
232
232
```
233
233
234
234
```
235
- X- Kubectl-Command: run
236
- X- Kubectl-Flags: --image
237
- X- Kubectl-Session: 0087f200-3079-458e-ae9a-b35305fb7432
238
- X- Kubectl-Deprecated: true
235
+ Kubectl-Command: run
236
+ Kubectl-Flags: --image
237
+ Kubectl-Session: 0087f200-3079-458e-ae9a-b35305fb7432
238
+ Kubectl-Deprecated: true
239
239
```
240
240
241
241
### Risks and Mitigations
@@ -279,20 +279,23 @@ can be no version skew.
279
279
280
280
* ** How can this feature be enabled / disabled in a live cluster?**
281
281
282
- This feature is enabled with the KUBECTL_COMMANDS_HEADER environment
283
- variable set on the client command line. Since it only affects the client
284
- kubectl, it does not affect any cluster components .
282
+ This feature is enabled by default in kubectl, and it be turned
283
+ off by setting the KUBECTL_COMMAND_HEADERS environment variable
284
+ to false .
285
285
286
286
- [X] Feature gate (also fill in values in ` kep.yaml ` )
287
- - Feature gate name: KUBECTL_COMMANDS_HEADERS
287
+ - Feature gate name: KUBECTL_COMMAND_HEADERS
288
288
- Components depending on the feature gate: kubectl
289
+
289
290
- [X] Other
290
- - Describe the mechanism: setting an client-side environment variable for kubectl.
291
+ - Describe the mechanism: To disable the default addition of the kubectl
292
+ extra headers, set the environment variable KUBECTL_COMMAND_HEADERS to false.
291
293
- Will enabling / disabling the feature require downtime of the control
292
- plane? No
294
+ plane?
295
+ No. This environment variable only affects the kubectl client.
293
296
- Will enabling / disabling the feature require downtime or reprovisioning
294
297
of a node? (Do not assume ` Dynamic Kubelet Config ` feature is enabled).
295
- No .
298
+ No. This environment variable only affects the kubectl client .
296
299
297
300
* ** Does enabling the feature change any default behavior?**
298
301
@@ -301,12 +304,12 @@ can be no version skew.
301
304
* ** Can the feature be disabled once it has been enabled (i.e. can we roll back
302
305
the enablement)?**
303
306
304
- Yes. This feature can be disabled by simply removing an environment variable
305
- on the client command line.
307
+ Yes. This feature can be disabled by simply setting the KUBECTL_COMMAND_HEADERS
308
+ environment variable to false on the command line.
306
309
307
310
* ** What happens if we reenable the feature if it was previously rolled back?**
308
311
309
- Re-enabling this feature is simply accomplished by setting the feature
312
+ Re-enabling this feature is simply accomplished by removing the feature
310
313
environment variable on the client command line. There is no state, and there
311
314
is no consequence for re-enabling the feature.
312
315
@@ -348,58 +351,55 @@ fields of API types, flags, etc.?**
348
351
349
352
### Monitoring Requirements
350
353
351
- _ This section must be completed when targeting beta graduation to a release._
352
-
353
354
* ** How can an operator determine if the feature is in use by workloads?**
354
355
Ideally, this should be a metric. Operations against the Kubernetes API (e.g.,
355
356
checking if there are objects with field X set) may be a last resort. Avoid
356
357
logs or events for this purpose.
357
358
358
- Operators will see this feature in use when the ** X-Kubectl-Command** header
359
- arrives with REST calls to the API Server.
359
+ N/A.
360
360
361
361
* ** What are the SLIs (Service Level Indicators) an operator can use to determine
362
362
the health of the service?**
363
363
364
- Since the cardinality is low, we will initially support the kubectl subcommand
365
- header (X-Kubectl-Command) in this feature. This simple metric will provide valuable
366
- insight into kubectl usage, and allow users to see if the feature is being used.
364
+ The risk of network performance degradation because of increased REST call
365
+ size is minimal, since the additional header size is modest, and it is
366
+ capped at MAX_HEADERS size. Determination of this network performance degradation
367
+ would be increased network latency, while testing using a control of kubectl
368
+ version 1.21 or previous to compare against.
367
369
368
- - [X ] Metrics
369
- - Metric name: X-Kubectl-Command header
370
+ - [ ] Metrics
371
+ - Metric name:
370
372
- [ Optional] Aggregation method:
371
- - Components exposing the metric: kubectl
373
+ - Components exposing the metric:
374
+
372
375
- [ ] Other (treat as last resort)
373
376
- Details:
374
377
375
378
* ** What are the reasonable SLOs (Service Level Objectives) for the above SLIs?**
376
379
377
- TBD
380
+ TBD. In order to mitigate risk of inordinately increasing the size of the REST
381
+ call, we use MAX_HEADERS to limit the size of the additional headers. The maximum
382
+ size of the current two headers (largest kubectl command) is approximately 72
383
+ bytes (including the header keys). This modest addition to the size of the REST
384
+ calls should translate to a minor performance degradation risk.
378
385
379
386
* ** Are there any missing metrics that would be useful to have to improve observability
380
387
of this feature?**
381
388
382
- We believe all the other specified ** X-Header ** will be useful, but we are starting
383
- out simply in alpha to prove the value and feasibility of the feature. We will add
384
- others as we approach beta .
389
+ We believe all the other specified ** Kubectl ** headers will be useful, but we are starting
390
+ out simply with two headers in beta to prove the value and feasibility of the feature. We
391
+ will add others as we approach GA .
385
392
386
393
### Dependencies
387
394
388
- _ This section must be completed when targeting beta graduation to a release._
389
-
390
395
* ** Does this feature depend on any specific services running in the cluster?**
391
396
Think about both cluster-level services (e.g. metrics-server) as well
392
397
as node-level agents (e.g. specific version of CRI). Focus on external or
393
398
optional services that are needed. For example, if this feature depends on
394
399
a cloud provider API, or upon an external software-defined storage or network
395
400
control plane.
396
401
397
- For each of these, fill in the following—thinking about running existing user workloads
398
- and creating new ones, as well as about cluster-level services (e.g. DNS):
399
- - [ Dependency name]
400
- - Usage description:
401
- - Impact of its outage on the feature:
402
- - Impact of its degraded performance or high-error rates on the feature:
402
+ No
403
403
404
404
### Scalability
405
405
@@ -425,16 +425,20 @@ the existing API objects?**
425
425
operations covered by [ existing SLIs/SLOs] ?**
426
426
427
427
Possibly. This feature increases the size of the REST call from kubectl
428
- to the API Server by adding more headers to the calls. We will monitor
429
- this request size increase to ensure there is no deleterious effect.
428
+ to the API Server by adding more headers to the calls. Constraining the
429
+ size of the added headers through MAX_HEADERS will reduce the risk of
430
+ any performance degradation. We will monitor this request size increase
431
+ to ensure there is no deleterious effect.
430
432
431
433
* ** Will enabling / using this feature result in non-negligible increase of
432
434
resource usage (CPU, RAM, disk, IO, ...) in any components?**
433
435
434
436
Possibly. This feature increases the size of the REST call from kubectl
435
- to the API Server by adding more headers to the calls. We will monitor
436
- this request size increase to ensure there is no deleterious effect.
437
+ to the API Server by adding more headers to the calls. Constraining the
438
+ size of the added headers through MAX_HEADERS will reduce the risk of
439
+ any performance degradation. We will monitor this request size increase
440
+ to ensure there is no deleterious effect.
437
441
438
442
## Implementation History
439
443
440
-
444
+ [ (Alpha) Kubectl command headers in requests: KEP 859 ] ( https://github.com/kubernetes/kubernetes/pull/98952 )
0 commit comments