Skip to content

Commit c388220

Browse files
committed
Update kubectl headers KEP to beta
1 parent 4b51418 commit c388220

File tree

3 files changed

+92
-85
lines changed

3 files changed

+92
-85
lines changed

keps/prod-readiness/sig-cli/859.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
kep-number: 859
22
alpha:
33
approver: "@deads2k"
4+
beta:
5+
approver: "@johnbelamaric"

keps/sig-cli/859-kubectl-headers/README.md

Lines changed: 83 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
- [Non-Goals](#non-goals)
1212
- [Anti-Goals](#anti-goals)
1313
- [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)
1616
- [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)
2020
- [Example](#example)
2121
- [Risks and Mitigations](#risks-and-mitigations)
2222
- [Design Details](#design-details)
@@ -44,7 +44,7 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
4444
- [X] (R) Graduation criteria is in place
4545
- [X] (R) Production readiness review completed
4646
- [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
4848
- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
4949
- [ ] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes
5050

@@ -123,23 +123,23 @@ Include in http requests made from kubectl to the apiserver:
123123
- if the command is deprecated, add a header including when which release it will be removed in (if known)
124124
- allow users and organizations that compile their own kubectl binaries to define a build metadata header
125125

126-
### X-Kubectl-Command Header
126+
### Kubectl-Command Header
127127

128-
The `X-Kubectl-Command` Header contains the kubectl sub command.
128+
The `Kubectl-Command` Header contains the kubectl sub command.
129129

130130
It contains the path to the subcommand (e.g. `create secret tls`) to disambiguate sub commands
131131
that might have the same name and different paths.
132132

133133
Examples:
134134

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`
139139

140-
### X-Kubectl-Flags Header
140+
### Kubectl-Flags Header
141141

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
143143
command. It does *not* contain the raw flag values, but may contain enumerations for
144144
whitelisted flag values. (e.g. for `-f` it may contain whether a local file, stdin, or remote file
145145
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.
148148

149149
Examples:
150150

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`
155155

156156
#### Enumerated Flag Values
157157

158158
- `-f`, `--filename`: `local`, `remote`, `stdin`
159159
- `-o`, `--output`: `json`,`yaml`,`wide`,`name`,`custom-columns`,`custom-columns-file`,`go-template`,`go-template-file`,`jsonpath`,`jsonpath-file`
160160
- `--type` (for patch subcommand): `json`, `merge`, `strategic`
161161

162-
### X-Kubectl-Session Header
162+
### Kubectl-Session Header
163163

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
165165
requests which were made from the same kubectl command invocation. The Session Header is generated
166166
once and used for all requests for each kubectl process.
167167

168-
- `X-Kubectl-Session: 67b540bf-d219-4868-abd8-b08c77fefeca`
168+
- `Kubectl-Session: 67b540bf-d219-4868-abd8-b08c77fefeca`
169169

170-
### X-Kubectl-Deprecated Header
170+
### Kubectl-Deprecated Header
171171

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
173173
has been deprecated. This may be used by organizations to determine if they are likely
174174
to be impacted by command deprecation and removal before they upgrade.
175175

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.
177177

178178
- The Header may have a value of `true` if the command has been deprecated, but has no removal date.
179179
- The Header may have a value of a specific Kubernetes release. If it does, this is the release
180180
that the command will be removed in.
181181

182-
- `X-Kubectl-Deprecated: true`
183-
- `X-Kubectl-Deprecated: v1.16`
182+
- `Kubectl-Deprecated: true`
183+
- `Kubectl-Deprecated: v1.16`
184184

185185

186-
### X-Kubectl-Build Header
186+
### Kubectl-Build Header
187187

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
189189
is unset, but may be set if kubectl is built from source, forked, or vendored into another command.
190190
Organizations that distribute one or more versions of kubectl which they maintain internally may
191191
set a flag at build time and this header will be populated with the value.
192192

193-
- `X-Kubectl-Build: some-value`
193+
- `Kubectl-Build: some-value`
194194

195195
### Example
196196

@@ -199,9 +199,9 @@ $ kubectl apply -f - -o yaml
199199
```
200200

201201
```
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
205205
```
206206

207207

@@ -210,9 +210,9 @@ $ kubectl apply -f ./local/file -o=custom-columns=NAME:.metadata.name
210210
```
211211

212212
```
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
216216
```
217217

218218
```sh
@@ -221,9 +221,9 @@ image"}]'
221221
```
222222

223223
```
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
227227
```
228228

229229

@@ -232,10 +232,10 @@ kubectl run nginx --image nginx
232232
```
233233

234234
```
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
239239
```
240240

241241
### Risks and Mitigations
@@ -279,20 +279,23 @@ can be no version skew.
279279

280280
* **How can this feature be enabled / disabled in a live cluster?**
281281

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.
285285

286286
- [X] Feature gate (also fill in values in `kep.yaml`)
287-
- Feature gate name: KUBECTL_COMMANDS_HEADERS
287+
- Feature gate name: KUBECTL_COMMAND_HEADERS
288288
- Components depending on the feature gate: kubectl
289+
289290
- [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.
291293
- 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.
293296
- Will enabling / disabling the feature require downtime or reprovisioning
294297
of a node? (Do not assume `Dynamic Kubelet Config` feature is enabled).
295-
No.
298+
No. This environment variable only affects the kubectl client.
296299

297300
* **Does enabling the feature change any default behavior?**
298301

@@ -301,12 +304,12 @@ can be no version skew.
301304
* **Can the feature be disabled once it has been enabled (i.e. can we roll back
302305
the enablement)?**
303306

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.
306309

307310
* **What happens if we reenable the feature if it was previously rolled back?**
308311

309-
Re-enabling this feature is simply accomplished by setting the feature
312+
Re-enabling this feature is simply accomplished by removing the feature
310313
environment variable on the client command line. There is no state, and there
311314
is no consequence for re-enabling the feature.
312315

@@ -348,58 +351,55 @@ fields of API types, flags, etc.?**
348351

349352
### Monitoring Requirements
350353

351-
_This section must be completed when targeting beta graduation to a release._
352-
353354
* **How can an operator determine if the feature is in use by workloads?**
354355
Ideally, this should be a metric. Operations against the Kubernetes API (e.g.,
355356
checking if there are objects with field X set) may be a last resort. Avoid
356357
logs or events for this purpose.
357358

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.
360360

361361
* **What are the SLIs (Service Level Indicators) an operator can use to determine
362362
the health of the service?**
363363

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.
367369

368-
- [X] Metrics
369-
- Metric name: X-Kubectl-Command header
370+
- [ ] Metrics
371+
- Metric name:
370372
- [Optional] Aggregation method:
371-
- Components exposing the metric: kubectl
373+
- Components exposing the metric:
374+
372375
- [ ] Other (treat as last resort)
373376
- Details:
374377

375378
* **What are the reasonable SLOs (Service Level Objectives) for the above SLIs?**
376379

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.
378385

379386
* **Are there any missing metrics that would be useful to have to improve observability
380387
of this feature?**
381388

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.
385392

386393
### Dependencies
387394

388-
_This section must be completed when targeting beta graduation to a release._
389-
390395
* **Does this feature depend on any specific services running in the cluster?**
391396
Think about both cluster-level services (e.g. metrics-server) as well
392397
as node-level agents (e.g. specific version of CRI). Focus on external or
393398
optional services that are needed. For example, if this feature depends on
394399
a cloud provider API, or upon an external software-defined storage or network
395400
control plane.
396401

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
403403

404404
### Scalability
405405

@@ -425,16 +425,20 @@ the existing API objects?**
425425
operations covered by [existing SLIs/SLOs]?**
426426

427427
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.
430432

431433
* **Will enabling / using this feature result in non-negligible increase of
432434
resource usage (CPU, RAM, disk, IO, ...) in any components?**
433435

434436
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.
437441

438442
## Implementation History
439443

440-
444+
[(Alpha) Kubectl command headers in requests: KEP 859](https://github.com/kubernetes/kubernetes/pull/98952)

keps/sig-cli/859-kubectl-headers/kep.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ title: Kubectl Commands In Headers
22
kep-number: 859
33
authors:
44
- "@pwittrock"
5+
- "@seans3"
56
owning-sig: sig-cli
67
participating-sigs:
78
- sig-api-machinery
@@ -10,25 +11,25 @@ reviewers:
1011
- "@kow3ns"
1112
- "@lavalamp"
1213
approvers:
13-
- "@seans3"
1414
- "@soltysh"
1515
prr-approvers:
1616
- "@deads2k"
1717
editor: TBD
1818
creation-date: 2019-02-22
19-
last-updated: 2019-02-22
19+
last-updated: 2019-05-11
2020
status: implementable
2121
see-also:
2222
replaces:
2323
superseded-by:
24-
stage: alpha
25-
latest-milestone: "v1.21"
24+
stage: beta
25+
latest-milestone: "v1.22"
2626
milestone:
2727
alpha: "v1.21"
2828
beta: "v1.22"
2929
stable: "v1.24"
30-
# This "Kubectl Commands In Headers" feature is initially opt-in using
31-
# an environment variable. This feature is not user facing.
30+
# kubectl-commands-in-headers is on by default, but it can be
31+
# disabled by setting the feature gate (environment variable)
32+
# to false.
3233
feature-gates:
3334
- name: kubectl-commands-in-headers
3435
components:

0 commit comments

Comments
 (0)