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: content/en/docs/reference/access-authn-authz/authentication.md
+72-19Lines changed: 72 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -329,19 +329,42 @@ To enable the plugin, configure the following flags on the API server:
329
329
| `--oidc-ca-file` | The path to the certificate for the CA that signed your identity provider's web certificate. Defaults to the host's root CAs. | `/etc/kubernetes/ssl/kc-ca.pem` | No |
330
330
| `--oidc-signing-algs` | The signing algorithms accepted. Default is "RS256". | `RS512` | No |
331
331
332
-
##### Using Authentication Configuration
332
+
##### Authentication configuration from a file {#using-authentication-configuration}
JWT Authenticator is an authenticator to authenticate Kubernetes users using JWT compliant tokens. The authenticator will attempt to
337
337
parse a raw ID token, verify it's been signed by the configured issuer. The public key to verify the signature is discovered from the issuer's public endpoint using OIDC discovery.
338
338
339
-
The API server can be configured to use a JWT authenticator via the `--authentication-config` flag. This flag takes a path to a file containing the `AuthenticationConfiguration`. An example configuration is provided below.
340
-
To use this config, the `StructuredAuthenticationConfiguration` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
341
-
has to be enabled.
339
+
The minimum valid JWT payload must contain the following claims:
340
+
```yaml
341
+
{
342
+
"iss": "https://example.com", // must match the issuer.url
343
+
"aud": ["my-app"], // at least one of the entries in issuer.audiences must match the "aud" claim in presented JWTs.
344
+
"exp": 1234567890, // token expiration as Unix time (the number of seconds elapsed since January 1, 1970 UTC)
345
+
"<username-claim>": "user" // this is the username claim configured in the claimMappings.username.claim or claimMappings.username.expression
346
+
}
347
+
```
348
+
349
+
The configuration file approach allows you to configure multiple JWT authenticators, each with a unique `issuer.url` and `issuer.discoveryURL`. The configuration file even allows you to specify [CEL](/docs/reference/using-api/cel/)
350
+
expressions to map claims to user attributes, and to validate claims and user information. The API server also automatically reloads the authenticators when the configuration file is modified. You can use
351
+
`apiserver_authentication_config_controller_automatic_reload_last_timestamp_seconds`metric to monitor the last time the configuration was reloaded by the API server.
352
+
353
+
You must specify the path to the authentication configuration using the `--authentication-config` flag on the API server. If you want to use command line flags instead of the configuration file, those will continue to work as-is.
354
+
To access the new capabilities like configuring multiple authenticators, setting multiple audiences for an issuer, switch to using the configuration file.
355
+
356
+
For Kubernetes v{{< skew currentVersion >}}, the structured authentication configuration file format
357
+
is beta-level, and the mechanism for using that configuration is also beta. Provided you didn't specifically
358
+
disable the `StructuredAuthenticationConfiguration`
359
+
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) for your cluster,
360
+
you can turn on structured authentication by specifying the `--authentication-config` command line
361
+
argument to the kube-apiserver. An example of the structured authentication configuration file is shown below.
342
362
343
363
{{< note >}}
344
-
When the feature is enabled, setting both `--authentication-config` and any of the `--oidc-*` flags will result in an error. If you want to use the feature, you have to remove the `--oidc-*` flags and use the configuration file instead.
364
+
If you specify `--authentication-config` along with any of the `--oidc-*` command line arguments, this is
365
+
a misconfiguration. In this situation, the API server reports an errors and then immediately exits.
366
+
If you want to switch to using structured authentication configuration, you have to remove the `--oidc-*`
367
+
command line arguments, and use the configuration file instead.
345
368
{{< /note >}}
346
369
347
370
```yaml
@@ -350,14 +373,33 @@ When the feature is enabled, setting both `--authentication-config` and any of t
350
373
# CAUTION: this is an example configuration.
351
374
# Do not use this for your own cluster!
352
375
#
353
-
apiVersion: apiserver.config.k8s.io/v1alpha1
376
+
apiVersion: apiserver.config.k8s.io/v1beta1
354
377
kind: AuthenticationConfiguration
355
378
# list of authenticators to authenticate Kubernetes users using JWT compliant tokens.
379
+
# the maximum number of allowed authenticators is 64.
356
380
jwt:
357
381
- issuer:
382
+
# url must be unique across all authenticators.
383
+
# url must not conflict with issuer configured in --service-account-issuer.
358
384
url: https://example.com # Same as --oidc-issuer-url.
385
+
# discoveryURL, if specified, overrides the URL used to fetch discovery
386
+
# information instead of using "{url}/.well-known/openid-configuration".
387
+
# The exact value specified is used, so "/.well-known/openid-configuration"
388
+
# must be included in discoveryURL if needed.
389
+
#
390
+
# The "issuer" field in the fetched discovery information must match the "issuer.url" field
391
+
# in the AuthenticationConfiguration and will be used to validate the "iss" claim in the presented JWT.
392
+
# This is for scenarios where the well-known and jwks endpoints are hosted at a different
393
+
# location than the issuer (such as locally in the cluster).
394
+
# discoveryURL must be different from url if specified and must be unique across all authenticators.
Copy file name to clipboardExpand all lines: content/en/docs/reference/command-line-tools-reference/feature-gates/structured-authentication-configuration.md
0 commit comments