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
@@ -414,6 +414,8 @@ Webhook authentication is a hook for verifying bearer tokens.
414
414
415
415
* `--authentication-token-webhook-config-file` a configuration file describing how to access the remote webhook service.
416
416
* `--authentication-token-webhook-cache-ttl` how long to cache authentication decisions. Defaults to two minutes.
417
+
* `--authentication-token-webhook-version` determines whether to use `authentication.k8s.io/v1beta1` or `authentication.k8s.io/v1`
418
+
`TokenReview`objects to send/receive information from the webhook. Defaults to `v1beta1`.
417
419
418
420
The configuration file uses the [kubeconfig](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
419
421
file format. Within the file, `clusters` refers to the remote service and
@@ -447,72 +449,167 @@ contexts:
447
449
name: webhook
448
450
```
449
451
450
-
When a client attempts to authenticate with the API server using a bearer token
451
-
as discussed [above](#putting-a-bearer-token-in-a-request),
452
-
the authentication webhook POSTs a JSON-serialized `authentication.k8s.io/v1beta1` `TokenReview` object containing the token
453
-
to the remote service. Kubernetes will not challenge a request that lacks such a header.
452
+
When a client attempts to authenticate with the API server using a bearer token as discussed [above](#putting-a-bearer-token-in-a-request),
453
+
the authentication webhook POSTs a JSON-serialized `TokenReview` object containing the token to the remote service.
454
454
455
-
Note that webhook API objects are subject to the same [versioning compatibility rules](/docs/concepts/overview/kubernetes-api/)
456
-
as other Kubernetes API objects. Implementers should be aware of looser
457
-
compatibility promises for beta objects and check the "apiVersion" field of the
458
-
request to ensure correct deserialization. Additionally, the API server must
459
-
enable the `authentication.k8s.io/v1beta1` API extensions group (`--runtime-config=authentication.k8s.io/v1beta1=true`).
455
+
Note that webhook API objects are subject to the same [versioning compatibility rules](/docs/concepts/overview/kubernetes-api/) as other Kubernetes API objects.
456
+
Implementers should check the `apiVersion` field of the request to ensure correct deserialization,
457
+
and **must** respond with a `TokenReview` object of the same version as the request.
460
458
461
-
The POST body will be of the following format:
459
+
{{< tabs name="TokenReview_request" >}}
460
+
{{% tab name="authentication.k8s.io/v1" %}}
461
+
{{< note >}}
462
+
The Kubernetes API server defaults to sending `authentication.k8s.io/v1beta1` token reviews for backwards compatibility.
463
+
To opt into receiving `authentication.k8s.io/v1` token reviews, the API server must be started with `--authentication-token-webhook-version=v1`.
464
+
{{< /note >}}
462
465
463
-
```json
466
+
```yaml
467
+
{
468
+
"apiVersion": "authentication.k8s.io/v1",
469
+
"kind": "TokenReview",
470
+
"spec": {
471
+
# Opaque bearer token sent to the API server
472
+
"token": "014fbff9a07c...",
473
+
474
+
# Optional list of the audience identifiers for the server the token was presented to.
475
+
# Audience-aware token authenticators (for example, OIDC token authenticators)
476
+
# should verify the token was intended for at least one of the audiences in this list,
477
+
# and return the intersection of this list and the valid audiences for the token in the response status.
478
+
# This ensures the token is valid to authenticate to the server it was presented to.
479
+
# If no audiences are provided, the token should be validated to authenticate to the Kubernetes API server.
0 commit comments