Skip to content

Commit c106300

Browse files
authored
Merge pull request #39137 from Zhuzhenghao/certificate-signing-requests.md
[zh] Sync certificate-signing-requests.md
2 parents c809bcc + 3e88f65 commit c106300

File tree

1 file changed

+57
-71
lines changed

1 file changed

+57
-71
lines changed

content/zh-cn/docs/reference/access-authn-authz/certificate-signing-requests.md

Lines changed: 57 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ weight: 25
2222
The Certificates API enables automation of
2323
[X.509](https://www.itu.int/rec/T-REC-X.509) credential provisioning by providing
2424
a programmatic interface for clients of the Kubernetes API to request and obtain
25-
X.509 {{< glossary_tooltip term_id="certificate" text="certificates" >}}
26-
from a Certificate Authority (CA).
25+
X.509 {{< glossary_tooltip term_id="certificate" text="certificates" >}} from a Certificate Authority (CA).
2726
2827
A CertificateSigningRequest (CSR) resource is used to request that a certificate be signed
2928
by a denoted signer, after which the request may be approved or denied before
@@ -48,9 +47,9 @@ The CertificateSigningRequest resource type allows a client to ask for an X.509
4847
be issued, based on a signing request.
4948
5049
The CertificateSigningRequest object includes a PEM-encoded PKCS#10 signing request in
51-
the `spec.request` field. The CertificateSigningRequest denotes the _signer_ (the
50+
the `spec.request` field. The CertificateSigningRequest denotes the signer (the
5251
recipient that the request is being made to) using the `spec.signerName` field.
53-
Note that `spec.signerName` is a required key after api version `certificates.k8s.io/v1`.
52+
Note that `spec.signerName` is a required key after API version `certificates.k8s.io/v1`.
5453
In Kubernetes v1.22 and later, clients may optionally set the `spec.expirationSeconds`
5554
field to request a particular lifetime for the issued certificate. The minimum valid
5655
value for this field is `600`, i.e. ten minutes.
@@ -59,7 +58,7 @@ value for this field is `600`, i.e. ten minutes.
5958

6059
CertificateSigningRequest 资源类型允许客户使用它申请发放 X.509 证书。
6160
CertificateSigningRequest 对象 在 `spec.request` 中包含一个 PEM 编码的 PKCS#10 签名请求。
62-
CertificateSigningRequest 使用 `spec.signerName` 字段标示 _签名者_(请求的接收方)。
61+
CertificateSigningRequest 使用 `spec.signerName` 字段标示签名者(请求的接收方)。
6362
注意,`spec.signerName``certificates.k8s.io/v1` 之后的 API 版本是必填项。
6463
在 Kubernetes v1.22 和以后的版本,客户可以可选地设置 `spec.expirationSeconds`
6564
字段来为颁发的证书设定一个特定的有效期。该字段的最小有效值是 `600`,也就是 10 分钟。
@@ -68,10 +67,8 @@ CertificateSigningRequest 使用 `spec.signerName` 字段标示 _签名者_(
6867
Once created, a CertificateSigningRequest must be approved before it can be signed.
6968
Depending on the signer selected, a CertificateSigningRequest may be automatically approved
7069
by a {{< glossary_tooltip text="controller" term_id="controller" >}}.
71-
Otherwise, a CertificateSigningRequest must be manually approved
72-
either via the REST API (or client-go)
73-
or by running `kubectl certificate approve`.
74-
Likewise, a CertificateSigningRequest may also be denied,
70+
Otherwise, a CertificateSigningRequest must be manually approved either via the REST API (or client-go)
71+
or by running `kubectl certificate approve`. Likewise, a CertificateSigningRequest may also be denied,
7572
which tells the configured signer that it must not sign the request.
7673
-->
7774
创建完成的 CertificateSigningRequest,要先通过批准,然后才能签名。
@@ -82,15 +79,12 @@ which tells the configured signer that it must not sign the request.
8279
同样,CertificateSigningRequest 也可能被驳回,
8380
这就相当于通知了指定的签名者,这个证书不能签名。
8481

85-
<!--
86-
For certificates that have been approved, the next step is signing.
87-
The relevant signing controller
82+
<!--
83+
For certificates that have been approved, the next step is signing. The relevant signing controller
8884
first validates that the signing conditions are met and then creates a certificate.
89-
The signing controller then updates the CertificateSigningRequest,
90-
storing the new certificate into
85+
The signing controller then updates the CertificateSigningRequest, storing the new certificate into
9186
the `status.certificate` field of the existing CertificateSigningRequest object. The
92-
`status.certificate` field is either empty or contains a X.509 certificate,
93-
encoded in PEM format.
87+
`status.certificate` field is either empty or contains a X.509 certificate, encoded in PEM format.
9488
The CertificateSigningRequest `status.certificate` field is empty until the signer does this.
9589
-->
9690
对于已批准的证书,下一步是签名。
@@ -101,8 +95,7 @@ The CertificateSigningRequest `status.certificate` field is empty until the sign
10195
直到签名完成前,CertificateSigningRequest 的字段 `status.certificate` 都为空。
10296

10397
<!--
104-
Once the `status.certificate` field has been populated,
105-
the request has been completed and clients can now
98+
Once the `status.certificate` field has been populated, the request has been completed and clients can now
10699
fetch the signed certificate PEM data from the CertificateSigningRequest resource.
107100
The signers can instead deny certificate signing if the approval conditions are not met.
108101
-->
@@ -111,10 +104,8 @@ The signers can instead deny certificate signing if the approval conditions are
111104
当然如果不满足签名条件,签名者可以拒签。
112105

113106
<!--
114-
In order to reduce the number of old CertificateSigningRequest resources left
115-
in a cluster, a garbage collection
116-
controller runs periodically.
117-
The garbage collection removes CertificateSigningRequests that have not changed
107+
In order to reduce the number of old CertificateSigningRequest resources left in a cluster, a garbage collection
108+
controller runs periodically. The garbage collection removes CertificateSigningRequests that have not changed
118109
state for some duration:
119110
120111
* Approved requests: automatically deleted after 1 hour
@@ -127,17 +118,16 @@ state for some duration:
127118
一个垃圾收集控制器将会周期性地运行。
128119
此垃圾收集器会清除在一段时间内没有改变过状态的 CertificateSigningRequests:
129120

130-
* 已批准的请求:1小时后自动删除
131-
* 已拒绝的请求:1小时后自动删除
132-
* 已失败的请求:1小时后自动删除
133-
* 挂起的请求:24小时后自动删除
121+
* 已批准的请求:1 小时后自动删除
122+
* 已拒绝的请求:1 小时后自动删除
123+
* 已失败的请求:1 小时后自动删除
124+
* 挂起的请求:24 小时后自动删除
134125
* 所有请求:在颁发的证书过期后自动删除
135126

136127
<!--
137128
## Signers
138129
139-
Custom signerNames can also be specified. All signers should provide information about how they work
140-
so that clients can predict what will happen to their CSRs.
130+
Custom signerNames can also be specified. All signers should provide information about how they work so that clients can predict what will happen to their CSRs.
141131
This includes:
142132
-->
143133
## 签名者 {#signers}
@@ -149,27 +139,22 @@ This includes:
149139

150140
<!--
151141
1. **Trust distribution**: how trust (CA bundles) are distributed.
152-
2. **Permitted subjects**: any restrictions on and behavior
153-
when a disallowed subject is requested.
154-
3. **Permitted x509 extensions**: including IP subjectAltNames, DNS subjectAltNames,
155-
Email subjectAltNames, URI subjectAltNames etc,
156-
and behavior when a disallowed extension is requested.
157-
4. **Permitted key usages / extended key usages**: any restrictions on and behavior
158-
when usages different than the signer-determined usages are specified in the CSR.
159-
5. **Expiration/certificate lifetime**: whether it is fixed by the signer, configurable by the admin, determined by the CSR `spec.expirationSeconds` field, etc
142+
1. **Permitted subjects**: any restrictions on and behavior when a disallowed subject is requested.
143+
1. **Permitted x509 extensions**: including IP subjectAltNames, DNS subjectAltNames, Email subjectAltNames, URI subjectAltNames etc, and behavior when a disallowed extension is requested.
144+
1. **Permitted key usages / extended key usages**: any restrictions on and behavior when usages different than the signer-determined usages are specified in the CSR.
145+
1. **Expiration/certificate lifetime**: whether it is fixed by the signer, configurable by the admin, determined by the CSR `spec.expirationSeconds` field, etc
160146
and the behavior when the signer-determined expiration is different from the CSR `spec.expirationSeconds` field.
161-
6. **CA bit allowed/disallowed**: and behavior if a CSR contains a request
162-
a for a CA certificate when the signer does not permit it.
147+
1. **CA bit allowed/disallowed**: and behavior if a CSR contains a request a for a CA certificate when the signer does not permit it.
163148
-->
164149
1. **信任分发**:信任(CA 证书包)是如何分发的。
165-
2. **许可的主体**:当一个受限制的主体(subject)发送请求时,相应的限制和应对手段。
166-
3. **许可的 x509 扩展**:包括 IP subjectAltNames、DNS subjectAltNames、
150+
1. **许可的主体**:当一个受限制的主体(subject)发送请求时,相应的限制和应对手段。
151+
1. **许可的 x509 扩展**:包括 IP subjectAltNames、DNS subjectAltNames、
167152
Email subjectAltNames、URI subjectAltNames 等,请求一个受限制的扩展项时的应对手段。
168-
4. **许可的密钥用途/扩展的密钥用途**:当用途和签名者在 CSR 中指定的用途不同时,
153+
1. **许可的密钥用途/扩展的密钥用途**:当用途和签名者在 CSR 中指定的用途不同时,
169154
相应的限制和应对手段。
170-
5. **过期时间/证书有效期**:过期时间由签名者确定、由管理员配置、还是由 CSR `spec.expirationSeconds` 字段指定等,
155+
1. **过期时间/证书有效期**:过期时间由签名者确定、由管理员配置、还是由 CSR `spec.expirationSeconds` 字段指定等,
171156
以及签名者决定的过期时间与 CSR `spec.expirationSeconds` 字段不同时的应对手段。
172-
6. **允许/不允许 CA 位**:当 CSR 包含一个签名者并不允许的 CA 证书的请求时,相应的应对手段。
157+
1. **允许/不允许 CA 位**:当 CSR 包含一个签名者并不允许的 CA 证书的请求时,相应的应对手段。
173158

174159
<!--
175160
Commonly, the `status.certificate` field contains a single PEM-encoded X.509
@@ -218,22 +203,22 @@ Kubernetes provides built-in signers that each have a well-known `signerName`:
218203
-->
219204
### Kubernetes 签名者 {#kubernetes-signers}
220205

221-
Kubernetes提供了内置的签名者,每个签名者都有一个众所周知的 `signerName`:
206+
Kubernetes 提供了内置的签名者,每个签名者都有一个众所周知的 `signerName`:
222207

223208
<!--
224209
1. `kubernetes.io/kube-apiserver-client`: signs certificates that will be honored as client certificates by the API server.
225-
Never auto-approved by {{< glossary_tooltip term_id="kube-controller-manager" >}}.
226-
1. Trust distribution: signed certificates must be honored as client-certificates by the kube-apiserver. The CA bundle is not distributed by any other means.
227-
1. Permitted subjects - no subject restrictions, but approvers and signers may choose not to approve or sign.
228-
Certain subjects like cluster-admin level users or groups vary between distributions and installations,
229-
but deserve additional scrutiny before approval and signing.
230-
The `CertificateSubjectRestriction` admission plugin is enabled by default to restrict `system:masters`,
231-
but it is often not the only cluster-admin subject in a cluster.
232-
1. Permitted x509 extensions - honors subjectAltName and key usage extensions and discards other extensions.
233-
1. Permitted key usages - must include `["client auth"]`. Must not include key usages beyond `["digital signature", "key encipherment", "client auth"]`.
234-
1. Expiration/certificate lifetime - for the kube-controller-manager implementation of this signer, set to the minimum
235-
of the `--cluster-signing-duration` option or, if specified, the `spec.expirationSeconds` field of the CSR object.
236-
1. CA bit allowed/disallowed - not allowed.
210+
Never auto-approved by {{< glossary_tooltip term_id="kube-controller-manager" >}}.
211+
1. Trust distribution: signed certificates must be honored as client certificates by the API server. The CA bundle is not distributed by any other means.
212+
1. Permitted subjects - no subject restrictions, but approvers and signers may choose not to approve or sign.
213+
Certain subjects like cluster-admin level users or groups vary between distributions and installations,
214+
but deserve additional scrutiny before approval and signing.
215+
The `CertificateSubjectRestriction` admission plugin is enabled by default to restrict `system:masters`,
216+
but it is often not the only cluster-admin subject in a cluster.
217+
1. Permitted x509 extensions - honors subjectAltName and key usage extensions and discards other extensions.
218+
1. Permitted key usages - must include `["client auth"]`. Must not include key usages beyond `["digital signature", "key encipherment", "client auth"]`.
219+
1. Expiration/certificate lifetime - for the kube-controller-manager implementation of this signer, set to the minimum
220+
of the `--cluster-signing-duration` option or, if specified, the `spec.expirationSeconds` field of the CSR object.
221+
1. CA bit allowed/disallowed - not allowed.
237222
-->
238223
1. `kubernetes.io/kube-apiserver-client`:签名的证书将被 API 服务器视为客户证书。
239224
{{< glossary_tooltip term_id="kube-controller-manager" >}} 不会自动批准它。
@@ -278,7 +263,8 @@ Kubernetes提供了内置的签名者,每个签名者都有一个众所周知
278263
1. `kubernetes.io/kubelet-serving`: signs serving certificates that are honored as a valid kubelet serving certificate
279264
by the API server, but has no other guarantees.
280265
Never auto-approved by {{< glossary_tooltip term_id="kube-controller-manager" >}}.
281-
1. Trust distribution: signed certificates must be honored by the kube-apiserver as valid to terminate connections to a kubelet. The CA bundle is not distributed by any other means.
266+
1. Trust distribution: signed certificates must be honored by the API server as valid to terminate connections to a kubelet.
267+
The CA bundle is not distributed by any other means.
282268
1. Permitted subjects - organizations are exactly `["system:nodes"]`, common name starts with "`system:node:`".
283269
1. Permitted x509 extensions - honors key usage and DNSName/IPAddress subjectAltName extensions, forbids EmailAddress and
284270
URI subjectAltName extensions, drops other extensions. At least one DNS or IP subjectAltName must be present.
@@ -292,7 +278,7 @@ Kubernetes提供了内置的签名者,每个签名者都有一个众所周知
292278
1. 信任分发:签名的证书必须被 kube-apiserver 认可,可有效的中止 kubelet 连接。CA 证书包不通过任何其他方式分发。
293279
1. 许可的主体:组织名必须是 `["system:nodes"]`,用户名以 "`system:node:`" 开头
294280
1. 许可的 x509 扩展:允许 key usage、DNSName/IPAddress subjectAltName 等扩展,
295-
禁止 EmailAddress、URI subjectAltName 等扩展,并丢弃其他扩展。
281+
禁止 EmailAddress、URI subjectAltName 等扩展,并丢弃其他扩展。
296282
至少有一个 DNS 或 IP 的 SubjectAltName 存在。
297283
1. 许可的密钥用途:必须是 `["key encipherment", "digital signature", "server auth"]`
298284
1. 过期时间/证书有效期:对于 kube-controller-manager 实现的签名者,
@@ -304,7 +290,7 @@ Kubernetes提供了内置的签名者,每个签名者都有一个众所周知
304290
may honor client certificates signed by it. The stable CertificateSigningRequest API (version `certificates.k8s.io/v1` and later)
305291
does not allow to set the `signerName` as `kubernetes.io/legacy-unknown`.
306292
Never auto-approved by {{< glossary_tooltip term_id="kube-controller-manager" >}}.
307-
1. Trust distribution: None. There is no standard trust or distribution for this signer in a Kubernetes cluster.
293+
1. Trust distribution: None. There is no standard trust or distribution for this signer in a Kubernetes cluster.
308294
1. Permitted subjects - any
309295
1. Permitted x509 extensions - honors subjectAltName and key usage extensions and discards other extensions.
310296
1. Permitted key usages - any
@@ -423,7 +409,7 @@ To allow signing a CertificateSigningRequest:
423409
{{< codenew file="access/certificate-signing-request/clusterrole-sign.yaml" >}}
424410

425411
<!--
426-
## Normal User
412+
## Normal user
427413
428414
A few steps are required in order to get a normal user to be able to
429415
authenticate and invoke an API. First, this user must have a certificate issued
@@ -457,8 +443,7 @@ openssl req -new -key myuser.key -out myuser.csr
457443
<!--
458444
### Create CertificateSigningRequest
459445
460-
Create a CertificateSigningRequest and submit it to a Kubernetes Cluster via kubectl.
461-
Below is a script to generate the CertificateSigningRequest.
446+
Create a CertificateSigningRequest and submit it to a Kubernetes Cluster via kubectl. Below is a script to generate the CertificateSigningRequest.
462447
-->
463448
### 创建 CertificateSigningRequest {#create-certificatesigningrequest}
464449

@@ -544,7 +529,7 @@ Export the issued certificate from the CertificateSigningRequest.
544529

545530
从 CertificateSigningRequest 导出颁发的证书。
546531

547-
```
532+
```shell
548533
kubectl get csr myuser -o jsonpath='{.status.certificate}'| base64 -d > myuser.crt
549534
```
550535

@@ -581,14 +566,13 @@ kubectl create rolebinding developer-binding-myuser --role=developer --user=myus
581566
582567
The last step is to add this user into the kubeconfig file.
583568
584-
First, we need to add new credentials:
569+
First, you need to add new credentials:
585570
-->
586571
### 添加到 kubeconfig {#add-to-kubeconfig}
587572

588573
最后一步是将这个用户添加到 kubeconfig 文件。
589-
我们假设私钥和证书文件存放在 “/home/vagrant/work/” 目录中。
590574

591-
首先,我们需要添加新的凭据
575+
首先,你需要添加新的凭据
592576

593577
```shell
594578
kubectl config set-credentials myuser --client-key=myuser.key --client-certificate=myuser.crt --embed-certs=true
@@ -726,7 +710,7 @@ you like. If you want to add a note for human consumption, use the
726710
-->
727711
`status.conditions.reason` 字段通常设置为一个首字母大写的对机器友好的原因码;
728712
这是一个命名约定,但你也可以随你的个人喜好设置。
729-
如果你想添加一个供人类使用的注释,那就用 `status.conditions.message` 字段。
713+
如果你想添加一个供人类使用的注释,那就用 `status.conditions.message` 字段。
730714

731715
<!--
732716
## Signing
@@ -737,8 +721,6 @@ The Kubernetes control plane implements each of the
737721
[Kubernetes signers](/docs/reference/access-authn-authz/certificate-signing-requests/#kubernetes-signers),
738722
as part of the kube-controller-manager.
739723

740-
Prior to Kubernetes v1.18, the kube-controller-manager would sign any CSRs that
741-
were marked as approved.
742724
-->
743725
## 签名 {#signing}
744726

@@ -749,8 +731,12 @@ Kubernetes 控制平面实现了每一个
749731
每个签名者的实现都是 kube-controller-manager 的一部分。
750732

751733
{{< note >}}
752-
在Kubernetes v1.18 之前,
753-
kube-controller-manager 签名所有标记为 approved 的 CSR。
734+
<!--
735+
Prior to Kubernetes v1.18, the kube-controller-manager would sign any CSRs that
736+
were marked as approved.
737+
-->
738+
在 Kubernetes v1.18 之前,
739+
kube-controller-manager 签名所有标记为 approved 的 CSR。
754740
{{< /note >}}
755741

756742
{{< note >}}

0 commit comments

Comments
 (0)