@@ -348,7 +348,23 @@ talk to the API server. Accounts may be explicitly associated with pods using th
348
348
{{< /note >}}
349
349
350
350
<!--
351
- # this apiVersion is relevant as of Kubernetes 1.9
351
+ ```yaml
352
+ apiVersion: apps/v1 # this apiVersion is relevant as of Kubernetes 1.9
353
+ kind: Deployment
354
+ metadata:
355
+ name: nginx-deployment
356
+ namespace: default
357
+ spec:
358
+ replicas: 3
359
+ template:
360
+ metadata:
361
+ # ...
362
+ spec:
363
+ serviceAccountName: bob-the-bot
364
+ containers:
365
+ - name: nginx
366
+ image: nginx:1.14.2
367
+ ```
352
368
-->
353
369
``` yaml
354
370
apiVersion : apps/v1 # 此 apiVersion 从 Kubernetes 1.9 开始可用
@@ -570,7 +586,7 @@ To enable the plugin, configure the following flags on the API server:
570
586
| `--oidc-groups-prefix` | Prefix prepended to group claims to prevent clashes with existing names (such as `system:` groups). For example, the value `oidc:` will create group names like `oidc:engineering` and `oidc:infra`. | `oidc:` | No |
571
587
| `--oidc-required-claim` | A key=value pair that describes a required claim in the ID Token. If set, the claim is verified to be present in the ID Token with a matching value. Repeat this flag to specify multiple claims. | `claim=value` | No |
572
588
| `--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 |
573
- | `--oidc-signing-algs` | The signing algorithms accepted. Default is " RS256" . | `RS512` | No |
589
+ | `--oidc-signing-algs` | The signing algorithms accepted. Default is RS256. Allowed values are : RS256, RS384, RS512, ES256, ES384, ES512, PS256, PS384, PS512. Values are defined by RFC 7518 https://tools.ietf.org/html/rfc7518#section-3.1 . | `RS512` | No |
574
590
-->
575
591
576
592
| 参数 | 描述 | 示例 | 必需? |
@@ -583,7 +599,7 @@ To enable the plugin, configure the following flags on the API server:
583
599
| `--oidc-groups-prefix` | 添加到组申领的前缀,用来避免与现有用户组名(如:`system:` 组)发生冲突。例如,此标志值为 `oidc:` 时,所得到的用户组名形如 `oidc:engineering` 和 `oidc:infra`。 | `oidc:` | 否 |
584
600
| `--oidc-required-claim` | 取值为一个 key=value 偶对,意为 ID 令牌中必须存在的申领。如果设置了此标志,则 ID 令牌会被检查以确定是否包含取值匹配的申领。此标志可多次重复,以指定多个申领。 | `claim=value` | 否 |
585
601
| `--oidc-ca-file` | 指向一个 CA 证书的路径,该 CA 负责对你的身份服务的 Web 证书提供签名。默认值为宿主系统的根 CA。 | `/etc/kubernetes/ssl/kc-ca.pem` | 否 |
586
- | `--oidc-signing-algs` | 采纳的签名算法。默认为 "RS256"。 | `RS512` | 否 |
602
+ | `--oidc-signing-algs` | 采纳的签名算法。默认为 "RS256"。可选值为:RS256、RS384、RS512、ES256、ES384、ES512、PS256、PS384、PS512。值由 RFC 7518 https://tools.ietf.org/html/rfc7518#section-3.1 定义。 | `RS512` | 否 |
587
603
588
604
<!--
589
605
# #### Authentication configuration from a file {#using-authentication-configuration}
889
905
# expression 是一个计算结果为布尔值的 CEL 表达式。
890
906
# 所有表达式的计算结果必须为 true,用户才有效。
891
907
- expression: "!user.username.startsWith('system:')"
892
- # Message 自定义验证失败时在 API 服务器日志中看到的错误消息。
908
+ # message 是自定义验证失败时在 API 服务器日志中看到的错误消息。
893
909
message: 'username cannot used reserved system: prefix'
894
910
- expression: "user.groups.all(group, !group.startsWith('system:'))"
895
911
message: 'groups cannot used reserved system: prefix'
@@ -943,16 +959,38 @@ jwt:
943
959
944
960
Here are examples of the `AuthenticationConfiguration` with different token payloads.
945
961
-->
946
- 要了解更多信息,请参阅[CEL 文档](/docs/reference/using-api/cel/)。
962
+ 要了解更多信息,请参阅 [CEL 文档](/zh-cn /docs/reference/using-api/cel/)。
947
963
948
964
以下是具有不同令牌有效负载的 “AuthenticationConfiguration” 示例。
949
965
950
966
951
967
{{< tabs name="example_configuration" >}}
952
968
{{% tab name="Valid token" %}}
953
969
<!--
954
- # the expression will evaluate to true, so validation will succeed.
970
+ ` ` ` yaml
971
+ apiVersion: apiserver.config.k8s.io/v1beta1
972
+ kind: AuthenticationConfiguration
973
+ jwt:
974
+ - issuer:
975
+ url: https://example.com
976
+ audiences:
977
+ - my-app
978
+ claimMappings:
979
+ username:
980
+ expression: 'claims.username + ":external-user"'
981
+ groups:
982
+ expression: 'claims.roles.split(",")'
983
+ uid:
984
+ expression: 'claims.sub'
985
+ extra:
986
+ - key: 'example.com/tenant'
987
+ valueExpression: 'claims.tenant'
988
+ userValidationRules:
989
+ - expression: "!user.username.startsWith('system:')" # the expression will evaluate to true, so validation will succeed.
990
+ message: 'username cannot used reserved system: prefix'
991
+ ` ` `
955
992
-->
993
+
956
994
` ` ` yaml
957
995
apiVersion: apiserver.config.k8s.io/v1beta1
958
996
kind: AuthenticationConfiguration
@@ -1022,8 +1060,32 @@ jwt:
1022
1060
{{% /tab %}}
1023
1061
{{% tab name="Fails claim validation" %}}
1024
1062
<!--
1025
- # the token below does not have this claim, so validation will fail.
1026
- # the expression will evaluate to true, so validation will succeed.
1063
+ ` ` ` yaml
1064
+ apiVersion: apiserver.config.k8s.io/v1beta1
1065
+ kind: AuthenticationConfiguration
1066
+ jwt:
1067
+ - issuer:
1068
+ url: https://example.com
1069
+ audiences:
1070
+ - my-app
1071
+ claimValidationRules:
1072
+ - expression: 'claims.hd == "example.com"' # the token below does not have this claim, so validation will fail.
1073
+ message: the hd claim must be set to example.com
1074
+ claimMappings:
1075
+ username:
1076
+ expression: 'claims.username + ":external-user"'
1077
+ groups:
1078
+ expression: 'claims.roles.split(",")'
1079
+ uid:
1080
+ expression: 'claims.sub'
1081
+ extra:
1082
+ - key: 'example.com/tenant'
1083
+ valueExpression: 'claims.tenant'
1084
+ userValidationRules:
1085
+ - expression: "!user.username.startsWith('system:')" # the expression will evaluate to true, so validation will succeed.
1086
+ message: 'username cannot used reserved system: prefix'
1087
+ ` ` `
1088
+
1027
1089
-->
1028
1090
` ` ` yaml
1029
1091
apiVersion: apiserver.config.k8s.io/v1beta1
@@ -1085,9 +1147,33 @@ jwt:
1085
1147
{{% tab name="Fails user validation" %}}
1086
1148
1087
1149
<!--
1088
- # this will prefix the username with "system:" and will fail user validation.
1089
- # the username will be system:foo and expression will evaluate to false, so validation will fail.
1150
+ ` ` ` yaml
1151
+ apiVersion: apiserver.config.k8s.io/v1beta1
1152
+ kind: AuthenticationConfiguration
1153
+ jwt:
1154
+ - issuer:
1155
+ url: https://example.com
1156
+ audiences:
1157
+ - my-app
1158
+ claimValidationRules:
1159
+ - expression: 'claims.hd == "example.com"'
1160
+ message: the hd claim must be set to example.com
1161
+ claimMappings:
1162
+ username:
1163
+ expression: '"system:" + claims.username' # this will prefix the username with "system:" and will fail user validation.
1164
+ groups:
1165
+ expression: 'claims.roles.split(",")'
1166
+ uid:
1167
+ expression: 'claims.sub'
1168
+ extra:
1169
+ - key: 'example.com/tenant'
1170
+ valueExpression: 'claims.tenant'
1171
+ userValidationRules:
1172
+ - expression: "!user.username.startsWith('system:')" # the username will be system:foo and expression will evaluate to false, so validation will fail.
1173
+ message: 'username cannot used reserved system: prefix'
1174
+ ` ` `
1090
1175
-->
1176
+
1091
1177
` ` ` yaml
1092
1178
apiVersion: apiserver.config.k8s.io/v1beta1
1093
1179
kind: AuthenticationConfiguration
0 commit comments