@@ -5,7 +5,7 @@ date: 2024-04-29
5
5
slug : structured-authentication-moves-to-beta
6
6
---
7
7
8
- ** Authors :** [ Anish Ramasekar] ( https://github.com/aramase ) (Microsoft)
8
+ ** Author :** [ Anish Ramasekar] ( https://github.com/aramase ) (Microsoft)
9
9
10
10
With Kubernetes 1.30, we (SIG Auth) are moving Structured Authentication Configuration to beta.
11
11
@@ -19,22 +19,22 @@ Structured Authentication Configuration feature is the first step towards
19
19
addressing these limitations and providing a more flexible and extensible way
20
20
to configure authentication in Kubernetes.
21
21
22
- ## What is Structured Authentication Configuration?
23
-
24
- The Structured Authentication Configuration feature is a new way to configure
25
- authentication in Kubernetes. It currently only supports configuring JWT
22
+ ## What is structured authentication configuration?
23
+ Kubernetes v1.30 builds on the experimental support for configurating authentication based on
24
+ a file, that was added as alpha in Kubernetes v1.30. At this beta stage, Kubernetes only supports configuring JWT
26
25
authenticators, which serve as the next iteration of the existing OIDC
27
26
authenticator. JWT authenticator is an authenticator to
28
27
authenticate Kubernetes users using JWT compliant tokens. The authenticator
29
28
will attempt to parse a raw ID token, verify it's been signed by the configured
30
29
issuer.
31
30
32
- The feature is designed to be more flexible and extensible than the existing
33
- flag-based approach for configuring the JWT authenticator.
31
+ The Kubernetes project added configuration from a file so that it can provide more
32
+ flexibility than using command line options (which continue to work, and are still supported).
33
+ Supporting a configuration file also makes it easy to deliver further improvements in upcoming
34
+ releases.
34
35
35
- ### Benefits of Structured Authentication Configuration
36
- The Structured Authentication Configuration feature brings several benefits to
37
- Kubernetes:
36
+ ### Benefits of structured authentication configuration
37
+ Here's why using a configuration file to configure cluster authentication is a benefit:
38
38
1 . ** Multiple JWT authenticators** : You can configure multiple JWT authenticators
39
39
simultaneously. This allows you to use multiple identity providers (e.g.,
40
40
Okta, Keycloak, GitLab) without needing to use an intermediary like Dex
@@ -45,23 +45,24 @@ Kubernetes:
45
45
3 . ** Any JWT-compliant token** : You can use any JWT-compliant token for
46
46
authentication. This allows you to use tokens from any identity provider that
47
47
supports JWT. The minimum valid JWT payload must contain the claims documented
48
- [ here] ( https://github.com/kubernetes/kubernetes/blob/121607e80963370c1838f9f620c2b8552041abfc/staging/src/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/types.go#L152-L157 ) .
48
+ in [ structured authentication configuration] ( /docs/reference/access-authn-authz/authentication/#using-authentication-configuration )
49
+ page in the Kubernetes documentation.
49
50
4 . ** CEL (Common Expression Language) support** : You can use [ CEL] ( /docs/reference/using-api/cel/ )
50
51
to determine whether the token's claims match the user's attributes in Kubernetes (e.g.,
51
52
username, group). This allows you to use complex logic to determine whether a
52
53
token is valid.
53
54
5 . ** Multiple audiences** : You can configure multiple audiences for a single
54
55
authenticator. This allows you to use the same authenticator for multiple
55
56
audiences, such as using a different OAuth client for ` kubectl ` and dashboard.
56
- 6 . ** Using Identity providers that don't support OpenID connect discovery** : You
57
+ 6 . ** Using identity providers that don't support OpenID connect discovery** : You
57
58
can use identity providers that don't support [ OpenID Connect
58
59
discovery] ( https://openid.net/specs/openid-connect-discovery-1_0.html ) . The only
59
60
requirement is to host the discovery document at a different location than the
60
61
issuer (such as locally in the cluster) and specify the ` issuer.discoveryURL ` in
61
62
the configuration file.
62
63
63
64
## How to use Structured Authentication Configuration
64
- To use the Structured Authentication Configuration feature , you must specify
65
+ To use structured authentication configuration , you specify
65
66
the path to the authentication configuration using the ` --authentication-config `
66
67
command line argument in the API server. The configuration file is a YAML file
67
68
that specifies the authenticators and their configuration. Here is an example
@@ -70,6 +71,8 @@ configuration file that configures two JWT authenticators:
70
71
``` yaml
71
72
apiVersion : apiserver.config.k8s.io/v1beta1
72
73
kind : AuthenticationConfiguration
74
+ # Someone with a valid token from either of these issuers could authenticate
75
+ # against this cluster.
73
76
jwt :
74
77
- issuer :
75
78
url : https://issuer1.example.com
79
82
audienceMatchPolicy : MatchAny
80
83
claimValidationRules :
81
84
expression : ' claims.hd == "example.com"'
82
- message : " the hd claim must be example.com"
85
+ message : " the hosted domain name must be example.com"
83
86
claimMappings :
84
87
username :
85
88
expression : ' claims.username'
104
107
audienceMatchPolicy : MatchAny
105
108
claimValidationRules :
106
109
expression : ' claims.hd == "example.com"'
107
- message : " the hd claim must be example.com"
110
+ message : " the hosted domain name must be example.com"
108
111
claimMappings :
109
112
username :
110
113
expression : ' claims.username'
@@ -120,12 +123,12 @@ jwt:
120
123
message : " username cannot use reserved system: prefix"
121
124
` ` `
122
125
123
- ## Migration from command line flags to configuration file
126
+ ## Migration from command line arguments to configuration file
124
127
The Structured Authentication Configuration feature is designed to be
125
- backwards-compatible with the existing flag- based approach for configuring the
126
- JWT authenticator. This means that you can continue to use the existing
127
- command-line flags to configure the JWT authenticator. However, we recommend
128
- migrating to the new configuration file-based approach, as it provides more
128
+ backwards-compatible with the existing approach, based on command line options, for
129
+ configuring the JWT authenticator. This means that you can continue to use the existing
130
+ command-line options to configure the JWT authenticator. However, we (Kubernetes SIG Auth)
131
+ recommend migrating to the new configuration file-based approach, as it provides more
129
132
flexibility and extensibility.
130
133
131
134
{{% alert title="Note" color="primary" %}}
@@ -139,7 +142,7 @@ command line arguments, and use the configuration file instead.
139
142
Here is an example of how to migrate from the command-line flags to the
140
143
configuration file :
141
144
142
- # ## Command-line flags
145
+ # ## Command-line arguments
143
146
` ` ` bash
144
147
--oidc-issuer-url=https://issuer.example.com
145
148
--oidc-client-id=example-client-id
@@ -152,9 +155,9 @@ configuration file:
152
155
--oidc-ca-file=/path/to/ca.pem
153
156
` ` `
154
157
155
- > There is no equivalent in the configuration file for the `--oidc-signing-algs`.
156
- > The authenticator will support all asymmetric algorithms listed
157
- > [here ](https://github.com/kubernetes/kubernetes/blob/b4935d910dcf256288694391ef675acfbdb8e7a3/staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/oidc/oidc.go#L222-L233).
158
+ There is no equivalent in the configuration file for the `--oidc-signing-algs`.
159
+ For Kubernetes v1.30, the authenticator supports all the asymmetric algorithms listed in
160
+ [`oidc.go` ](https://github.com/kubernetes/kubernetes/blob/b4935d910dcf256288694391ef675acfbdb8e7a3/staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/oidc/oidc.go#L222-L233).
158
161
159
162
# ## Configuration file
160
163
` ` ` yaml
@@ -189,21 +192,21 @@ feedback. In the coming releases, we want to investigate:
189
192
190
193
You can learn more about this feature on the [structured authentication
191
194
configuration](/docs/reference/access-authn-authz/authentication/#using-authentication-configuration)
192
- Kubernetes doc website . You can also follow along on the
195
+ page in the Kubernetes documentation . You can also follow along on the
193
196
[KEP-3331](https://kep.k8s.io/3331) to track progress across the coming
194
197
Kubernetes releases.
195
198
196
- # # Call to action
197
- In this post, we have covered the benefits the Structured Authentication
199
+ # # Try it out
200
+ In this post, I have covered the benefits the Structured Authentication
198
201
Configuration feature brings in Kubernetes v1.30. To use this feature, you must specify the path to the
199
202
authentication configuration using the `--authentication-config` command line
200
203
argument. From Kubernetes v1.30, the feature is in beta and enabled by default.
201
- If you want to keep using command line flags instead of a configuration file,
204
+ If you want to keep using command line arguments instead of a configuration file,
202
205
those will continue to work as-is.
203
206
204
207
We would love to hear your feedback on this feature. Please reach out to us on the
205
208
[#sig-auth-authenticators-dev](https://kubernetes.slack.com/archives/C04UMAUC4UA)
206
- channel on Kubernetes Slack.
209
+ channel on Kubernetes Slack (for an invitation, visit [https://slack.k8s.io/](https://slack.k8s.io/)) .
207
210
208
211
# # How to get involved
209
212
If you are interested in getting involved in the development of this feature,
0 commit comments