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
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)
57
57
-[ ] (R) Production readiness review completed
58
58
-[ ] (R) Production readiness review approved
@@ -148,7 +148,10 @@ When a TokenRequest is being issued/fulfilled, we will modify the issuing code t
148
148
can be later used to trace the requests that a specific issued token has made to the apiserver via the audit log.
149
149
150
150
This will require changing the JWT issuing code to actually generate this UUID, as well as extending the code around the
151
-
audit log to have it record this information into audit entries.
151
+
audit log to have it record this information into audit entries when a token is issued (via the `authentication.k8s.io/issued-credential-id` audit annotation).
152
+
153
+
As this UUID will be embedded as part of a user's ExtraInfo, it'll automatically be persisted into audit events for all
154
+
requests made using a token that embeds a credential identifier (as `authentication.k8s.io/credential-id`).
152
155
153
156
### User Stories (Optional)
154
157
@@ -164,10 +167,10 @@ The node assertion can be checked to ensure the host identity matches the node a
164
167
Bob is an administrator of a cluster and has noticed some strange request patterns from an unknown service account.
165
168
166
169
Bob would like to understand who initially issued/authorised this token to be issued. To do so, Bob looks up the JTI
167
-
of the token making the suspicious requests by looking inside the audit log entries for these suspect requests.
170
+
of the token making the suspicious requests by looking inside the audit log entries at user's ExtraInfo for these suspect requests.
168
171
169
172
This JTI is then used for a further audit log lookup - namely, looking for the TokenRequest `create` call which contains
170
-
the audit annotation with key `authentication.kubernetes.io/token-identifier` and the value set to that of the suspect token.
173
+
the audit annotation with key `authentication.kubernetes.io/issued-credential-id` and the value set to that of the suspect token.
171
174
172
175
This allows Bob to determine precisely who made the original request for this token, and (depending on the 'chain'
173
176
above this token), allows Bob to recursively perform this lookup to find all involved parties that led to this token
[] 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
220
223
existing tests to make this code solid enough prior to committing the changes necessary
221
224
to implement this enhancement.
222
225
@@ -229,17 +232,34 @@ implementing this enhancement to ensure the enhancements have also solid foundat
229
232
230
233
##### Unit tests
231
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).
-[TestServiceAccountTokenCreate_bound to a service account and pod](https://github.com/kubernetes/kubernetes/blob/release-1.29/test/integration/auth/svcaccttoken_test.go#L247)
308
+
-[TestServiceAccountTokenCreate_bound to service account and a pod with an assigned nodeName that does not exist](https://github.com/kubernetes/kubernetes/blob/release-1.29/test/integration/auth/svcaccttoken_test.go#L415)
309
+
-[TestServiceAccountTokenCreate_bound to service account and a pod with an assigned nodeName](https://github.com/kubernetes/kubernetes/blob/release-1.29/test/integration/auth/svcaccttoken_test.go#L416)
310
+
-[TestServiceAccountTokenCreate_fails to bind to a Node if the feature gate is disabled](https://github.com/kubernetes/kubernetes/blob/release-1.29/test/integration/auth/svcaccttoken_test.go#L418)
311
+
-[TestServiceAccountTokenCreate_bound to service account and node](https://github.com/kubernetes/kubernetes/blob/release-1.29/test/integration/auth/svcaccttoken_test.go#L448)
- Decide what the default of the new flag should be
332
+
- Decision: this flag was not added during alpha, and MAY be added post-beta, but will definitely default to **off**.
333
+
- This does not need to block promotion of ServiceAccountTokenPodNodeInfo feature as a result.
307
334
- Decide if using an audit annotation is the correct approach
335
+
- Decision: audit annotation is the correct approach as this is only for `serviceaccounts/<name>/token` requests, not all
336
+
- Renaming audit annotation to `authentication.kubernetes.io/issued-credential-id` to disambiguate from `authentication.kubernetes.io/credential-id` in user's ExtraInfo
308
337
- Docs around the SA JWT schema (this does not exist today)
309
338
310
339
#### GA
@@ -360,9 +389,17 @@ you need any help or guidance.
360
389
361
390
*`ServiceAccountTokenJTI` feature flag will toggle including JTI information in tokens, as well as recording JTIs in the audit log / the SA user info.
362
391
*`ServiceAccountTokenPodNodeInfo` feature flag will toggle including node info associated with pods in tokens.
392
+
*`ServiceAccountTokenNodeBindingValidation` feature flag will toggle the apiserver validating Node claims in node bound service account tokens.
363
393
*`ServiceAccountTokenNodeBinding` feature flag will toggle allowing service account tokens to be bound to Node objects.
364
394
365
-
Both of these feature flags can be disabled without any unexpected adverse affects or coordination required.
395
+
The `ServiceAccountTokenNodeBindingValidation` feature will graduate to beta in version v1.30, a release earlier than `ServiceAccountTokenNodeBinding`
396
+
to ensure a safe rollback from version v1.31 to v1.30 (more info below in rollback considerations section).
397
+
398
+
The `ServiceAccountTokenNodeBinding` feature gate must only be enabled once the `ServiceAccountTokenNodeBindingValidation` feature has been enabled.
399
+
Disabling the `ServiceAccountTokenNodeBindingValidation` feature whilst keeping `ServiceAccountTokenNodeBinding` would allow tokens that are expected to
400
+
be bound to the lifetime of a particular Node to validate even if that Node no longer exists.
401
+
402
+
All other feature flags can be disabled without any unexpected adverse affects or coordination required.
366
403
367
404
###### How can this feature be enabled / disabled in a live cluster?
368
405
@@ -413,7 +450,8 @@ The `ServiceAccountTokenNodeBindingValidation` feature gate should be enabled an
413
450
any server.
414
451
415
452
The `ServiceAccountTokenNodeBindingValidation` will be defaulted to on one release **before**`ServiceAccountTokenNodeBinding`
416
-
to account for this.
453
+
to account for this. Concretely, `ServiceAccountTokenNodeBindingValidation` will be enabled by default in v1.30 and
454
+
`ServiceAccountTokenNodeBinding` will be enabled by default in v1.31.
417
455
418
456
This should not have any issues/affect during upgrades.
419
457
Rollback is done by removing/disabling the feature gate(s).
@@ -431,6 +469,10 @@ To help avoid this, the feature will be graduated in two phases:
431
469
432
470
This allows for a safe rollback in which the same security expectations are enforced once a token has been issued.
433
471
472
+
If a user explicitly *disables*`ServiceAccountTokenNodeBindingValidation` but keeps `ServiceAccountTokenNodeBinding` enabled,
473
+
the node claims in the issued tokens will not be properly validated. This configuration will be explicitly denied by the
474
+
kube-apiserver and will cause it to exit on startup.
475
+
434
476
###### What specific metrics should inform a rollback?
435
477
436
478
*`authentication_attempts`
@@ -447,6 +489,52 @@ New metrics that can be used to identify if the feature is in use:
447
489
448
490
###### Were upgrade and rollback tested? Was the upgrade->downgrade->upgrade path tested?
*Without* the feature gate enabled, tokens that are bound to Pod objects will not include information about the Node
530
+
that the pod is scheduled/assigned to.
531
+
532
+
*With* the feature enabled, newly minted tokens that are bound to Pod objects will include metadata about the Node, namely
533
+
the Node's name and UID.
534
+
535
+
These fields are **not validated** and therefore disabling the feature after enabling it will not cause any adverse side-effects.
536
+
537
+
``
450
538
<!--
451
539
Describe manual testing that was done and the outcomes.
452
540
Longer term, we may want to require automated upgrade/rollback tests, but we
@@ -592,8 +680,20 @@ For each of them, fill in the following information by copying the below templat
592
680
593
681
###### What steps should be taken if SLOs are not being met to determine the problem?
594
682
683
+
After observing an issue (e.g. uptick in denied authentication requests or a significant shift in any metrics added for this KEP),
684
+
kube-apiserver logs from the authenticator may be used to debug.
685
+
686
+
Additionally, manually attempting to exercise the affected codepaths would surface information that'd aid debugging.
687
+
For example, attempting to issue a node bound token, or attempting to authenticate to the apiserver using a node bound token.
688
+
595
689
## Implementation History
596
690
691
+
* KEP marked implementable and merged for the v1.29 release
692
+
* KEP implemented in an alpha state for v1.29
693
+
* Renamed audit annotation used for the `serviceaccounts/<name>/token` endpoint to be clearer: https://github.com/kubernetes/kubernetes/pull/123098
694
+
* Added restrictions to disallow enabling `ServiceAccountTokenNodeBinding` without `ServiceAccountTokenNodeBindingValidation`: https://github.com/kubernetes/kubernetes/pull/123135
695
+
*`ServiceAccountTokenJTI`, `ServiceAccountTokenNodeBindingValidation` and `ServiceAccountTokenPodNodeInfo` promoted to beta for v1.30 release
696
+
597
697
<!--
598
698
Major milestones in the lifecycle of a KEP should be tracked in this section.
0 commit comments