@@ -482,6 +482,34 @@ is included in a request.
482
482
` id_token` (而非 `access_token`)作为持有者令牌。
483
483
关于如何在请求中设置令牌,可参见[前文](#putting-a-bearer-token-in-a-request)。
484
484
485
+ <!--
486
+ sequenceDiagram
487
+ participant user as User
488
+ participant idp as Identity Provider
489
+ participant kube as kubectl
490
+ participant api as API Server
491
+
492
+ user ->> idp : 1. Log in to IdP
493
+ activate idp
494
+ idp -->> user : 2. Provide access_token,<br>id_token, and refresh_token
495
+ deactivate idp
496
+ activate user
497
+ user ->> kube : 3. Call kubectl<br>with --token being the id_token<br>OR add tokens to .kube/config
498
+ deactivate user
499
+ activate kube
500
+ kube ->> api : 4. Authorization: Bearer...
501
+ deactivate kube
502
+ activate api
503
+ api ->> api : 5. Is JWT signature valid?
504
+ api ->> api : 6. Has the JWT expired? (iat+exp)
505
+ api ->> api : 7. User authorized?
506
+ api -->> kube : 8. Authorized: Perform<br>action and return result
507
+ deactivate api
508
+ activate kube
509
+ kube --x user : 9. Return result
510
+ deactivate kube
511
+ -->
512
+
485
513
{{< mermaid >}}
486
514
sequenceDiagram
487
515
participant user as 用户
722
750
# PEM encoded CA certificates used to validate the connection when fetching
723
751
# discovery information. If not set, the system verifier will be used.
724
752
# Same value as the content of the file referenced by the --oidc-ca-file flag.
725
- certificateAuthority: <PEM encoded CA certificates>
753
+ certificateAuthority: <PEM encoded CA certificates>
726
754
# audiences is the set of acceptable audiences the JWT must be issued to.
727
755
# At least one of the entries must match the "aud" claim in presented JWTs.
728
756
audiences:
936
964
937
965
` jwt.userValidationRules[i].expression` 表示将由 CEL 计算的表达式。
938
966
CEL 表达式可以访问 `userInfo` 的内容,并组织成 `user` CEL 变量。
939
- 有关 `user` 的架构 ,请参阅
940
- [UserInfo](/zh-cn/docs/reference/ generated/kubernetes-api/v{{< skew currentVersion >}}/#userinfo-v1-authentication-k8s-io) API 文档。
967
+ 有关 `user` 的结构 ,请参阅
968
+ [UserInfo](/zh-cn/docs/reference/generated/kubernetes-api/v{{< skew currentVersion >}}/#userinfo-v1-authentication-k8s-io) API 文档。
941
969
942
970
<!--
943
971
* Claim mapping expression
963
991
964
992
以下是具有不同令牌有效负载的 “AuthenticationConfiguration” 示例。
965
993
966
-
967
994
{{< tabs name="example_configuration" >}}
968
995
{{% tab name="Valid token" %}}
969
996
<!--
@@ -1247,7 +1274,7 @@ jwt:
1247
1274
which will fail user validation because the username starts with `system:`.
1248
1275
The API server will return `401 Unauthorized` error.
1249
1276
-->
1250
- 这将导致用户验证失败,因为用户名以 `system:` 开头。 API 服务器将返回 `401 Unauthorized` 错误。
1277
+ 这将导致用户验证失败,因为用户名以 `system:` 开头。API 服务器将返回 `401 Unauthorized` 错误。
1251
1278
{{% /tab %}}
1252
1279
{{< /tabs >}}
1253
1280
@@ -1264,20 +1291,12 @@ jwt:
1264
1291
1265
1292
<!--
1266
1293
Kubernetes does not provide an OpenID Connect Identity Provider.
1267
- You can use an existing public OpenID Connect Identity Provider (such as Google, or
1268
- [others](https://connect2id.com/products/nimbus-oauth-openid-connect-sdk/openid-connect-providers)).
1269
- Or, you can run your own Identity Provider, such as [dex](https://dexidp.io/),
1270
- [Keycloak](https://github.com/keycloak/keycloak),
1271
- CloudFoundry [UAA](https://github.com/cloudfoundry/uaa), or
1272
- Tremolo Security's [OpenUnison](https://openunison.github.io/).
1294
+ You can use an existing public OpenID Connect Identity Provider or run your own Identity Provider
1295
+ that supports the OpenID Connect protocol.
1273
1296
-->
1274
1297
Kubernetes 并未提供 OpenID Connect 的身份服务。
1275
- 你可以使用现有的公共的 OpenID Connect 身份服务
1276
- (例如 Google 或者[其他服务](https://connect2id.com/products/nimbus-oauth-openid-connect-sdk/openid-connect-providers))。
1277
- 或者,你也可以选择自己运行一个身份服务,例如 [dex](https://dexidp.io/)、
1278
- [Keycloak](https://github.com/keycloak/keycloak)、
1279
- CloudFoundry [UAA](https://github.com/cloudfoundry/uaa) 或者
1280
- Tremolo Security 的 [OpenUnison](https://openunison.github.io/)。
1298
+ 你可以使用现有的公共的 OpenID Connect 身份服务或者运行你自己的
1299
+ OpenID Connect 身份服务。
1281
1300
1282
1301
<!--
1283
1302
For an identity provider to work with Kubernetes it must :
@@ -1306,33 +1325,18 @@ For an identity provider to work with Kubernetes it must:
1306
1325
1307
1326
<!--
1308
1327
A note about requirement # 3 above, requiring a CA signed certificate. If you deploy your own
1309
- identity provider (as opposed to one of the cloud providers like Google or Microsoft) you MUST
1310
- have your identity provider's web server certificate signed by a certificate with the `CA` flag
1311
- set to `TRUE`, even if it is self signed. This is due to GoLang's TLS client implementation
1312
- being very strict to the standards around certificate validation. If you don't have a CA handy,
1313
- you can use the [gencert script](https://github.com/dexidp/dex/blob/master/examples/k8s/gencert.sh)
1314
- from the Dex team to create a simple CA and a signed certificate and key pair. Or you can use
1315
- [this similar script](https://raw.githubusercontent.com/TremoloSecurity/openunison-qs-kubernetes/master/src/main/bash/makessl.sh)
1316
- that generates SHA256 certs with a longer life and larger key size.
1328
+ identity provider you MUST have your identity provider's web server certificate signed by a
1329
+ certificate with the `CA` flag set to `TRUE`, even if it is self signed. This is due to GoLang's
1330
+ TLS client implementation being very strict to the standards around certificate validation. If you
1331
+ don't have a CA handy, you can create a simple CA and a signed certificate and key pair using
1332
+ standard certificate generation tools.
1317
1333
-->
1318
1334
关于上述第三条需求,即要求具备 CA 签名的证书,有一些额外的注意事项。
1319
- 如果你部署了自己的身份服务,而不是使用云厂商(如 Google 或 Microsoft)所提供的服务,
1320
- 你必须对身份服务的 Web 服务器证书进行签名,签名所用证书的 `CA` 标志要设置为
1321
- ` TRUE` ,即使用的是自签名证书。这是因为 GoLang 的 TLS 客户端实现对证书验证标准方面有非常严格的要求。
1322
- 如果你手头没有现成的 CA 证书,可以使用 Dex
1323
- 团队所开发的[证书生成脚本](https://github.com/dexidp/dex/blob/master/examples/k8s/gencert.sh)
1324
- 来创建一个简单的 CA 和被签了名的证书与密钥对。
1325
- 或者你也可以使用[这个类似的脚本](https://raw.githubusercontent.com/TremoloSecurity/openunison-qs-kubernetes/master/src/main/bash/makessl.sh),
1326
- 生成一个合法期更长、密钥尺寸更大的 SHA256 证书。
1327
-
1328
- <!--
1329
- Refer to setup instructions for specific systems :
1330
- -->
1331
- 参阅特定系统的安装指令:
1332
-
1333
- - [UAA](https://docs.cloudfoundry.org/concepts/architecture/uaa.html)
1334
- - [Dex](https://dexidp.io/docs/kubernetes/)
1335
- - [OpenUnison](https://www.tremolosecurity.com/orchestra-k8s/)
1335
+ 如果你部署了自己的身份服务,你必须对身份服务的 Web 服务器证书进行签名,
1336
+ 签名所用证书的 `CA` 标志要设置为 `TRUE`,即使用的是自签名证书。
1337
+ 这是因为 GoLang 的 TLS 客户端实现对证书验证标准方面有非常严格的要求。
1338
+ 如果你手头没有现成的 CA 证书,可以使用标准证书生成工具来创建一个简单的
1339
+ CA 和被签了名的证书与密钥对。
1336
1340
1337
1341
<!--
1338
1342
# ### Using kubectl
@@ -1448,7 +1452,7 @@ Webhook 身份认证是一种用来验证持有者令牌的回调机制。
1448
1452
默认时长为 2 分钟。
1449
1453
* `--authentication-token-webhook-version` 决定是使用 `authentication.k8s.io/v1beta1` 还是
1450
1454
` authenticationk8s.io/v1` 版本的 `TokenReview` 对象从 Webhook 发送/接收信息。
1451
- 默认为“ v1beta1” 。
1455
+ 默认为 ` v1beta1` 。
1452
1456
1453
1457
<!--
1454
1458
The configuration file uses the [kubeconfig](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
@@ -1535,7 +1539,7 @@ and **must** respond with a `TokenReview` object of the same version as the requ
1535
1539
要注意的是,Webhook API 对象和其他 Kubernetes API 对象一样,
1536
1540
也要受到同一[版本兼容规则](/zh-cn/docs/concepts/overview/kubernetes-api/)约束。
1537
1541
实现者应检查请求的 `apiVersion` 字段以确保正确的反序列化,
1538
- 并且 **必须** 以与请求相同版本的 `TokenReview` 对象进行响应。
1542
+ 并且**必须**以与请求相同版本的 `TokenReview` 对象进行响应。
1539
1543
1540
1544
{{< tabs name="TokenReview_request" >}}
1541
1545
{{% tab name="authentication.k8s.io/v1" %}}
@@ -1573,7 +1577,7 @@ Kubernetes API 服务器默认发送 `authentication.k8s.io/v1beta1` 令牌以
1573
1577
"apiVersion": "authentication.k8s.io/v1",
1574
1578
"kind": "TokenReview",
1575
1579
"spec": {
1576
- # 发送到 API 服务器的不透明持有者令牌
1580
+ # 发送到 API 服务器的不透明持有者令牌
1577
1581
"token": "014fbff9a07c...",
1578
1582
1579
1583
# 提供令牌的服务器的受众标识符的可选列表。
@@ -2115,7 +2119,7 @@ The following HTTP headers can be used to performing an impersonation request:
2115
2119
此字段可选;要求 "Impersonate-User" 被设置。为了能够以一致的形式保留,
2116
2120
` <附加名称>` 部分必须是小写字符,
2117
2121
如果有任何字符不是[合法的 HTTP 头部标签字符](https://tools.ietf.org/html/rfc7230#section-3.2.6),
2118
- 则必须是 utf8 字符,且转换为[百分号编码](https://tools.ietf.org/html/rfc3986#section-2.1)。
2122
+ 则必须是 UTF-8 字符,且转换为[百分号编码](https://tools.ietf.org/html/rfc3986#section-2.1)。
2119
2123
* `Impersonate-Uid`:一个唯一标识符,用来表示所伪装的用户。此头部可选。
2120
2124
如果设置,则要求 "Impersonate-User" 也存在。Kubernetes 对此字符串没有格式要求。
2121
2125
@@ -2519,7 +2523,7 @@ users:
2519
2523
- "arg1"
2520
2524
- "arg2"
2521
2525
2522
- # 当可执行文件不存在时显示给用户的文本。可选的 。
2526
+ # 当可执行文件不存在时显示给用户的文本。可选字段 。
2523
2527
installHint: |
2524
2528
需要 example-client-go-exec-plugin 来在当前集群上执行身份认证。可以通过以下命令安装:
2525
2529
@@ -2662,7 +2666,7 @@ users:
2662
2666
- "arg1"
2663
2667
- "arg2"
2664
2668
2665
- # 当可执行文件不存在时显示给用户的文本。可选的 。
2669
+ # 当可执行文件不存在时显示给用户的文本。可选字段 。
2666
2670
installHint: |
2667
2671
需要 example-client-go-exec-plugin 来在当前集群上执行身份认证。可以通过以下命令安装:
2668
2672
@@ -2702,7 +2706,6 @@ contexts:
2702
2706
user: my-user
2703
2707
current-context: my-cluster
2704
2708
` ` `
2705
-
2706
2709
{{% /tab %}}
2707
2710
{{< /tabs >}}
2708
2711
@@ -2953,6 +2956,7 @@ The following `ExecCredential` manifest describes a cluster information sample.
2953
2956
}
2954
2957
` ` `
2955
2958
{{% /tab %}}
2959
+
2956
2960
{{% tab name="client.authentication.k8s.io/v1beta1" %}}
2957
2961
` ` ` json
2958
2962
{
0 commit comments