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
Copy file name to clipboardExpand all lines: keps/sig-auth/4193-bound-service-account-token-improvements/README.md
+47-9Lines changed: 47 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,14 +45,14 @@
45
45
46
46
Items marked with (R) are required *prior to targeting to a milestone / release*.
47
47
48
-
-[] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
49
-
-[] (R) KEP approvers have approved the KEP status as `implementable`
50
-
-[] (R) Design details are appropriately documented
51
-
-[] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
48
+
-[x] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
49
+
-[x] (R) KEP approvers have approved the KEP status as `implementable`
50
+
-[x] (R) Design details are appropriately documented
51
+
-[x] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
52
52
-[ ] e2e Tests for all Beta API Operations (endpoints)
53
53
-[ ] (R) Ensure GA e2e tests meet requirements for [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md)
54
54
-[ ] (R) Minimum Two Week Window for GA e2e tests to prove flake free
55
-
-[] (R) Graduation criteria is in place
55
+
-[x] (R) Graduation criteria is in place
56
56
-[ ] (R) [all GA Endpoints](https://github.com/kubernetes/community/pull/1806) must be hit by [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md)
[] I/we understand the owners of the involved components may require updates to
222
+
[x] I/we understand the owners of the involved components may require updates to
223
223
existing tests to make this code solid enough prior to committing the changes necessary
224
224
to implement this enhancement.
225
225
@@ -232,17 +232,34 @@ implementing this enhancement to ensure the enhancements have also solid foundat
232
232
233
233
##### Unit tests
234
234
235
+
`pkg/registry/core/serviceaccount/storage`:
236
+
* Coverage before (`release-1.28`): `k8s.io/kubernetes/pkg/registry/core/serviceaccount/storage 8.354s coverage: 10.7% of statements`
237
+
* Coverage after: `k8s.io/kubernetes/pkg/registry/core/serviceaccount/storage 8.394s coverage: 8.7% of statements`
238
+
* Test ensuring audit annotations are added to audit events for the `serviceaccounts/<name>/token` subresource.
239
+
* Tests verifying it's possible to bind a token to a Node object.
240
+
* Tests ensuring tokens bound to pod objects also embed associated node metadata.
241
+
* NOTE: the majority of this file is untested with *unit tests* (instead, using integration tests). [#121515](https://github.com/kubernetes/kubernetes/issues/121515).
* Coverage before (`release-1.28`): `k8s.io/apiserver/pkg/authentication/serviceaccount 0.567s coverage: 60.8% of statements`
245
+
* Coverage after: `k8s.io/apiserver/pkg/authentication/serviceaccount 0.569s coverage: 70.1% of statements`
236
246
* Test ensuring that service account info (JTI, node name and UID) is correctly extracted from a presented JWT.
237
247
* Tests to ensure the information is NOT extracted when the feature gate is disabled.
238
248
239
249
`pkg/serviceaccount`:
250
+
* Coverage before (`release-1.28`): `k8s.io/kubernetes/pkg/serviceaccount 0.755s coverage: 72.4% of statements`
251
+
* Coverage after: `k8s.io/kubernetes/pkg/serviceaccount 0.786s coverage: 72.7% of statements`
240
252
* Extending tests to ensure Node info is embedded into extended claims (name and uid)
241
253
* Tests to ensure `ID`/`JTI` field is always set to a random UUID.
242
254
* Tests to ensure the info embedded on a JWT is extracted from the token and into the ServiceAccountInfo when
243
255
a token is validated.
244
256
* Tests to ensure the information is NOT embedded or extracted when the feature gate is disabled.
245
257
258
+
`staging/src/k8s.io/kubectl/pkg/cmd/create`:
259
+
* Coverage before (`release-1.28`): `k8s.io/kubectl/pkg/cmd/create 0.995s coverage: 55.1% of statements`
260
+
* Coverage after: `k8s.io/kubectl/pkg/cmd/create 0.949s coverage: 55.2% of statements`
261
+
* Add tests ensuring it's possible to request a token that is bound to a Node object (gated by environment variable during alpha)
262
+
246
263
<!--
247
264
In principle every added code should have complete unit test coverage, so providing
248
265
the exact set of tests will not bring additional value.
@@ -370,8 +387,12 @@ you need any help or guidance.
370
387
*`ServiceAccountTokenNodeBindingValidation` feature flag will toggle the apiserver validating Node claims in node bound service account tokens.
371
388
*`ServiceAccountTokenNodeBinding` feature flag will toggle allowing service account tokens to be bound to Node objects.
372
389
373
-
The `ServiceAccountTokenNodeBindingValidation` feature will graduate to beta one release earlier than `ServiceAccountTokenNodeBinding`
374
-
to ensure a safe rollback from version N+1 to N (more info below in rollback considerations section).
390
+
The `ServiceAccountTokenNodeBindingValidation` feature will graduate to beta in version v1.30, a release earlier than `ServiceAccountTokenNodeBinding`
391
+
to ensure a safe rollback from version v1.31 to v1.30 (more info below in rollback considerations section).
392
+
393
+
The `ServiceAccountTokenNodeBinding` feature gate must only be enabled once the `ServiceAccountTokenNodeBindingValidation` feature has been enabled.
394
+
Disabling the `ServiceAccountTokenNodeBindingValidation` feature whilst keeping `ServiceAccountTokenNodeBinding` would allow tokens that are expected to
395
+
be bound to the lifetime of a particular Node to validate even if that Node no longer exists.
375
396
376
397
All other feature flags can be disabled without any unexpected adverse affects or coordination required.
377
398
@@ -424,7 +445,8 @@ The `ServiceAccountTokenNodeBindingValidation` feature gate should be enabled an
424
445
any server.
425
446
426
447
The `ServiceAccountTokenNodeBindingValidation` will be defaulted to on one release **before**`ServiceAccountTokenNodeBinding`
427
-
to account for this.
448
+
to account for this. Concretely, `ServiceAccountTokenNodeBindingValidation` will be enabled by default in v1.30 and
449
+
`ServiceAccountTokenNodeBinding` will be enabled by default in v1.31.
428
450
429
451
This should not have any issues/affect during upgrades.
430
452
Rollback is done by removing/disabling the feature gate(s).
@@ -442,6 +464,10 @@ To help avoid this, the feature will be graduated in two phases:
442
464
443
465
This allows for a safe rollback in which the same security expectations are enforced once a token has been issued.
444
466
467
+
If a user explicitly *disables*`ServiceAccountTokenNodeBindingValidation` but keeps `ServiceAccountTokenNodeBinding` enabled,
468
+
the node claims in the issued tokens will not be properly validated. This configuration will be explicitly denied by the
469
+
kube-apiserver and will cause it to exit on startup.
470
+
445
471
###### What specific metrics should inform a rollback?
446
472
447
473
*`authentication_attempts`
@@ -603,8 +629,20 @@ For each of them, fill in the following information by copying the below templat
603
629
604
630
###### What steps should be taken if SLOs are not being met to determine the problem?
605
631
632
+
After observing an issue (e.g. uptick in denied authentication requests or a significant shift in any metrics added for this KEP),
633
+
kube-apiserver logs from the authenticator may be used to debug.
634
+
635
+
Additionally, manually attempting to exercise the affected codepaths would surface information that'd aid debugging.
636
+
For example, attempting to issue a node bound token, or attempting to authenticate to the apiserver using a node bound token.
637
+
606
638
## Implementation History
607
639
640
+
* KEP marked implementable and merged for the v1.29 release
641
+
* KEP implemented in an alpha state for v1.29
642
+
* Renamed audit annotation used for the `serviceaccounts/<name>/token` endpoint to be clearer: https://github.com/kubernetes/kubernetes/pull/123098
643
+
* Added restrictions to disallow enabling `ServiceAccountTokenNodeBinding` without `ServiceAccountTokenNodeBindingValidation`: https://github.com/kubernetes/kubernetes/pull/123135
644
+
*`ServiceAccountTokenJTI`, `ServiceAccountTokenNodeBindingValidation` and `ServiceAccountTokenPodNodeInfo` promoted to beta for v1.30 release
645
+
608
646
<!--
609
647
Major milestones in the lifecycle of a KEP should be tracked in this section.
0 commit comments