@@ -326,7 +326,7 @@ bearer tokens to verify requests. The plugin takes two optional flags:
326326
327327* ` --service-account-key-file ` 文件包含 PEM 编码的 x509 RSA 或 ECDSA 私钥或公钥,
328328 用于验证 ServiceAccount 令牌。这样指定的文件可以包含多个密钥,
329- 并且可以使用不同的文件多次指定此参数。若未指定,则使用 --tls-private-key-file 参数。
329+ 并且可以使用不同的文件多次指定此参数。若未指定,则使用 ` --tls-private-key-file ` 参数。
330330* ` --service-account-lookup ` 如果启用,则从 API 删除的令牌会被回收。
331331
332332<!--
@@ -521,10 +521,6 @@ sequenceDiagram
5215211. Check to make sure the `id_token` hasn't expired
522522
523523 Perform claim and/or user validation if CEL expressions are configured with `AuthenticationConfiguration`.
524-
525- 1. Make sure the user is authorized
526- 1. Once authorized the API server returns a response to `kubectl`
527- 1. `kubectl` provides feedback to the user
528524-->
5295251. 登录到你的身份服务(Identity Provider)
5305262. 你的身份服务将为你提供 `access_token`、`id_token` 和 `refresh_token`
@@ -536,6 +532,11 @@ sequenceDiagram
536532
537533 如果使用 `AuthenticationConfiguration` 配置了 CEL 表达式,则执行申领和/或用户验证。
538534
535+ <!--
536+ 1. Make sure the user is authorized
537+ 1. Once authorized the API server returns a response to `kubectl`
538+ 1. `kubectl` provides feedback to the user
539+ -->
5395407. 确认用户有权限执行操作
5405418. 鉴权成功之后,API 服务器向 `kubectl` 返回响应
5415429. `kubectl` 向用户提供反馈信息
@@ -693,14 +694,25 @@ command line arguments, and use the configuration file instead.
693694如果你想切换到使用结构化身份认证配置,则必须删除 `--oidc-*` 命令行参数,并改用配置文件。
694695{{< /note >}}
695696
697+ {{< feature-state feature_gate_name="StructuredAuthenticationConfigurationEgressSelector" >}}
698+
699+ <!--
700+ The _egressSelectorType_ field in the JWT issuer configuration allows you to specify which egress selector
701+ should be used for sending all traffic related to the issuer (discovery, JWKS, distributed claims, etc).
702+ This feature requires the `StructuredAuthenticationConfigurationEgressSelector` feature gate to be enabled.
703+ -->
704+ JWT 发行者配置中的 **egressSelectorType**
705+ 字段允许你指定应使用哪个出口选择器来发送与发行者相关的所有流量(发现、JWKS、分布式申领等)。
706+ 此特性要求启用 `StructuredAuthenticationConfigurationEgressSelector` 特性门控。
707+
696708<!--
697709` ` ` yaml
698710---
699711#
700712# CAUTION: this is an example configuration.
701713# Do not use this for your own cluster!
702714#
703- apiVersion: apiserver.config.k8s.io/v1beta1
715+ apiVersion: apiserver.config.k8s.io/v1
704716kind: AuthenticationConfiguration
705717# list of authenticators to authenticate Kubernetes users using JWT compliant tokens.
706718# the maximum number of allowed authenticators is 64.
@@ -731,6 +743,13 @@ jwt:
731743 - my-other-app
732744 # this is required to be set to "MatchAny" when multiple audiences are specified.
733745 audienceMatchPolicy: MatchAny
746+ # egressSelectorType is an indicator of which egress selection should be used for sending all traffic related
747+ # to this issuer (discovery, JWKS, distributed claims, etc). If unspecified, no custom dialer is used.
748+ # When specified, the valid choices are "controlplane" and "cluster". These correspond to the associated
749+ # values in the --egress-selector-config-file.
750+ # - controlplane: for traffic intended to go to the control plane.
751+ # - cluster: for traffic intended to go to the system being managed by Kubernetes.
752+ egressSelectorType: <egress-selector-type>
734753 # rules applied to validate token claims to authenticate users.
735754 claimValidationRules:
736755 # Same as --oidc-required-claim key=value.
811830#
812831# 注意:这是一个示例配置,不要将其用于你自己的集群!
813832#
814- apiVersion: apiserver.config.k8s.io/v1beta1
833+ apiVersion: apiserver.config.k8s.io/v1
815834kind: AuthenticationConfiguration
816835# 使用 JWT 兼容令牌对 Kubernetes 用户进行身份认证的认证组件列表,允许的最大认证组件数量为 64。
817836jwt:
@@ -838,6 +857,14 @@ jwt:
838857 - my-other-app
839858 # 当指定多个受众时,需要将此字段设置为 “MatchAny”。
840859 audienceMatchPolicy: MatchAny
860+ # egressSelectorType 是一个指示符,用于指定应使用哪个出口选择器发送与此发行者相关的所有流量
861+ #(发现、JWKS、分布式申领等)。
862+ # 如果未指定,则不使用自定义拨号器。
863+ # 当指定时,有效选项为 "controlplane" 和 "cluster"。这些对应于
864+ # --egress-selector-config-file 中的相关值。
865+ # - controlplane:用于打算发往控制平面的流量。
866+ # - cluster:用于打算发往由 Kubernetes 管理的系统的流量。
867+ egressSelectorType: <egress-selector-type>
841868 # 用于验证令牌申领以对用户进行身份认证的规则。
842869 claimValidationRules:
843870 # 与 --oidc-required-claim key=value 一致
938965 ` jwt.userValidationRules[i].expression` 表示将由 CEL 计算的表达式。
939966 CEL 表达式可以访问 `userInfo` 的内容,并组织成 `user` CEL 变量。
940967 有关 `user` 的结构,请参阅
941- [UserInfo](/docs/reference/generated/kubernetes-api/v{{< skew currentVersion >}}/#userinfo-v1-authentication-k8s-io) API 文档。
968+ [UserInfo](/docs/reference/generated/kubernetes-api/v{{< skew currentVersion >}}/#userinfo-v1-authentication-k8s-io)
969+ API 文档。
942970
943971<!--
944972* Claim mapping expression
969997 {{% tab name="合法的令牌" %}}
970998 <!--
971999 ` ` ` yaml
972- apiVersion: apiserver.config.k8s.io/v1beta1
1000+ apiVersion: apiserver.config.k8s.io/v1
9731001 kind: AuthenticationConfiguration
9741002 jwt:
9751003 - issuer:
@@ -993,7 +1021,7 @@ jwt:
9931021 -->
9941022
9951023 ` ` ` yaml
996- apiVersion: apiserver.config.k8s.io/v1beta1
1024+ apiVersion: apiserver.config.k8s.io/v1
9971025 kind: AuthenticationConfiguration
9981026 jwt:
9991027 - issuer:
@@ -1062,56 +1090,56 @@ jwt:
10621090 {{% tab name="申领校验失败" %}}
10631091 <!--
10641092 ` ` ` yaml
1065- apiVersion: apiserver.config.k8s.io/v1beta1
1066- kind: AuthenticationConfiguration
1067- jwt:
1068- - issuer:
1069- url: https://example.com
1070- audiences:
1071- - my-app
1072- claimValidationRules:
1073- - expression: 'claims.hd == "example.com"' # the token below does not have this claim, so validation will fail.
1074- message: the hd claim must be set to example.com
1075- claimMappings:
1076- username:
1077- expression: 'claims.username + ":external-user"'
1078- groups:
1079- expression: 'claims.roles.split(",")'
1080- uid:
1081- expression: 'claims.sub'
1082- extra:
1083- - key: 'example.com/tenant'
1084- valueExpression: 'claims.tenant'
1085- userValidationRules:
1086- - expression: "!user.username.startsWith('system:')" # the expression will evaluate to true, so validation will succeed.
1087- message: 'username cannot used reserved system: prefix'
1093+ apiVersion: apiserver.config.k8s.io/v1
1094+ kind: AuthenticationConfiguration
1095+ jwt:
1096+ - issuer:
1097+ url: https://example.com
1098+ audiences:
1099+ - my-app
1100+ claimValidationRules:
1101+ - expression: 'claims.hd == "example.com"' # the token below does not have this claim, so validation will fail.
1102+ message: the hd claim must be set to example.com
1103+ claimMappings:
1104+ username:
1105+ expression: 'claims.username + ":external-user"'
1106+ groups:
1107+ expression: 'claims.roles.split(",")'
1108+ uid:
1109+ expression: 'claims.sub'
1110+ extra:
1111+ - key: 'example.com/tenant'
1112+ valueExpression: 'claims.tenant'
1113+ userValidationRules:
1114+ - expression: "!user.username.startsWith('system:')" # the expression will evaluate to true, so validation will succeed.
1115+ message: 'username cannot used reserved system: prefix'
10881116 ` ` `
10891117 -->
10901118
10911119 ` ` ` yaml
1092- apiVersion: apiserver.config.k8s.io/v1beta1
1093- kind: AuthenticationConfiguration
1094- jwt:
1095- - issuer:
1096- url: https://example.com
1097- audiences:
1098- - my-app
1099- claimValidationRules:
1100- - expression: 'claims.hd == "example.com"' # 下面的令牌没有此申领,因此验证将失败。
1101- message: the hd claim must be set to example.com
1102- claimMappings:
1103- username:
1104- expression: 'claims.username + ":external-user"'
1105- groups:
1106- expression: 'claims.roles.split(",")'
1107- uid:
1108- expression: 'claims.sub'
1109- extra:
1110- - key: 'example.com/tenant'
1111- valueExpression: 'claims.tenant'
1112- userValidationRules:
1113- - expression: "!user.username.startsWith('system:')" # 该表达式的计算结果将为 true,因此验证将会成功。
1114- message: 'username cannot used reserved system: prefix'
1120+ apiVersion: apiserver.config.k8s.io/v1
1121+ kind: AuthenticationConfiguration
1122+ jwt:
1123+ - issuer:
1124+ url: https://example.com
1125+ audiences:
1126+ - my-app
1127+ claimValidationRules:
1128+ - expression: 'claims.hd == "example.com"' # 下面的令牌没有此申领,因此验证将失败。
1129+ message: the hd claim must be set to example.com
1130+ claimMappings:
1131+ username:
1132+ expression: 'claims.username + ":external-user"'
1133+ groups:
1134+ expression: 'claims.roles.split(",")'
1135+ uid:
1136+ expression: 'claims.sub'
1137+ extra:
1138+ - key: 'example.com/tenant'
1139+ valueExpression: 'claims.tenant'
1140+ userValidationRules:
1141+ - expression: "!user.username.startsWith('system:')" # 该表达式的计算结果将为 true,因此验证将会成功。
1142+ message: 'username cannot used reserved system: prefix'
11151143 ` ` `
11161144
11171145 ` ` ` bash
@@ -1149,7 +1177,7 @@ jwt:
11491177
11501178 <!--
11511179 ` ` ` yaml
1152- apiVersion: apiserver.config.k8s.io/v1beta1
1180+ apiVersion: apiserver.config.k8s.io/v1
11531181 kind: AuthenticationConfiguration
11541182 jwt:
11551183 - issuer:
@@ -1176,7 +1204,7 @@ jwt:
11761204 -->
11771205
11781206 ` ` ` yaml
1179- apiVersion: apiserver.config.k8s.io/v1beta1
1207+ apiVersion: apiserver.config.k8s.io/v1
11801208 kind: AuthenticationConfiguration
11811209 jwt:
11821210 - issuer:
@@ -1257,12 +1285,10 @@ jwt:
12571285# ##### Limitations
12581286
125912871. Distributed claims do not work via [CEL](/docs/reference/using-api/cel/) expressions.
1260- 1. Egress selector configuration is not supported for calls to `issuer.url` and `issuer.discoveryURL`.
12611288-->
12621289# ##### 局限性
12631290
126412911. 分布式申领无法通过 [CEL](/zh-cn/docs/reference/using-api/cel/) 表达式工作。
1265- 2. 不支持调用 `issuer.url` 和 `issuer.discoveryURL` 的出口选择器配置。
12661292
12671293<!--
12681294Kubernetes does not provide an OpenID Connect Identity Provider.
@@ -2006,7 +2032,7 @@ A sample authentication configuration file is below:
20062032# CAUTION: this is an example configuration.
20072033# Do not use this for your own cluster!
20082034#
2009- apiVersion: apiserver.config.k8s.io/v1beta1
2035+ apiVersion: apiserver.config.k8s.io/v1
20102036kind: AuthenticationConfiguration
20112037anonymous:
20122038 enabled: true
@@ -2022,7 +2048,7 @@ anonymous:
20222048# 注意:这是一个示例配置。
20232049# 请勿将其用于你自己的集群!
20242050#
2025- apiVersion: apiserver.config.k8s.io/v1beta1
2051+ apiVersion: apiserver.config.k8s.io/v1
20262052kind: AuthenticationConfiguration
20272053anonymous:
20282054 enabled: true
0 commit comments