@@ -684,6 +684,171 @@ you like. If you want to add a note for human consumption, use the
684
684
这是一个命名约定,但你也可以随你的个人喜好设置。
685
685
如果你想添加一个供人类使用的注释,那就用 `status.conditions.message` 字段。
686
686
687
+ # # PodCertificateRequests {#pod-certificate-requests}
688
+
689
+ {{< feature-state feature_gate_name="PodCertificateRequest" >}}
690
+
691
+ {{< note >}}
692
+ <!--
693
+ In Kubernetes {{< skew currentVersion >}}, you must enable support for Pod
694
+ Certificates using the `PodCertificateRequest` [feature
695
+ gate](/docs/reference/command-line-tools-reference/feature-gates/) and the
696
+ ` --runtime-config=certificates.k8s.io/v1alpha1/podcertificaterequests=true`
697
+ kube-apiserver flag.
698
+ -->
699
+ 在 Kubernetes {{< skew currentVersion >}} 中,你必须使用 `PodCertificateRequest`
700
+ [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)和
701
+ ` --runtime-config=certificates.k8s.io/v1alpha1/podcertificaterequests=true` kube-apiserver
702
+ 标志来启用对 Pod 证书的支持。
703
+ {{< /note >}}
704
+
705
+ <!--
706
+ PodCertificateRequests are API objects tailored to provisioning certificates to
707
+ workloads running as Pods within a cluster. The user typically does not
708
+ interact with PodCertificateRequests directly, but uses [podCertificate
709
+ projected volume sources](
710
+ /docs/concepts/storage/projected-volumes#podcertificate), which are a `kubelet`
711
+ feature that handles secure key provisioning and automatic certificate refresh.
712
+ The application inside the pod only needs to know how to read the certificates
713
+ from the filesystem.
714
+
715
+ PodCertificateRequests are similar to CertificateSigningRequests, but have a
716
+ simpler format enabled by their narrower use case.
717
+ -->
718
+ PodCertificateRequest 是专门为集群内以 Pod 形式运行的工作负载提供证书的 API 对象。
719
+ 用户通常不直接与 PodCertificateRequests 交互,而是使用
720
+ [podCertificate 投射卷源](/zh-cn/docs/concepts/storage/projected-volumes#podcertificate),
721
+ 这是 `kubelet` 的一个特性,处理安全密钥配置和自动证书刷新。
722
+ Pod 内的应用程序只需要知道如何从文件系统读取证书。
723
+
724
+ PodCertificateRequest 类似于 CertificateSigningRequest,但由于其使用场景更窄,因此格式更简单。
725
+
726
+ <!--
727
+ A PodCertificateRequest has the following spec fields :
728
+ * `signerName`: The signer to which this request is addressed.
729
+ * `podName` and `podUID`: The Pod that Kubelet is requesting a certificate for.
730
+ * `serviceAccountName` and `serviceAccountUID`: The ServiceAccount corresponding to the Pod.
731
+ * `nodeName` and `nodeUID`: The Node corresponding to the Pod.
732
+ * `maxExpirationSeconds`: The maximum lifetime that the workload author will
733
+ accept for this certificate. Defaults to 24 hours if not specified.
734
+ * `pkixPublicKey`: The public key for which the certificate should be issued.
735
+ * `proofOfPossession`: A signature demonstrating that the requester controls the
736
+ private key corresponding to `pkixPublicKey`.
737
+ -->
738
+ PodCertificateRequest 包含以下 spec 字段:
739
+
740
+ * `signerName`:此请求所指向的签名者。
741
+ * `podName` 和 `podUID`:kubelet 为其请求证书的 Pod。
742
+ * `serviceAccountName` 和 `serviceAccountUID`:与 Pod 对应的 ServiceAccount。
743
+ * `nodeName` 和 `nodeUID`:与 Pod 对应的 Node。
744
+ * `maxExpirationSeconds`:工作负载作者将接受的此证书的最长生命周期。如果未指定,默认为 24 小时。
745
+ * `pkixPublicKey`:应为其颁发证书的公钥。
746
+ * `proofOfPossession`:一个签名,证明请求者控制着与 `pkixPublicKey` 对应的私钥。
747
+
748
+ <!--
749
+ Nodes automatically receive permissions to create PodCertificateRequests and
750
+ read PodCertificateRequests related to them (as determined by the
751
+ ` spec.nodeName` field). The `NodeRestriction` admission plugin, if enabled,
752
+ ensures that nodes can only create PodCertificateRequests that correspond to a
753
+ real pod that is currently running on the node.
754
+
755
+ After creation, the `spec` of a PodCertificateRequest is immutable.
756
+ -->
757
+ 节点自动获得创建与其相关的 PodCertificateRequests 以及读取与其相关的
758
+ PodCertificateRequest(由 `spec.nodeName` 字段决定)的权限。
759
+ 如果启用了 `NodeRestriction` 准入插件,它会确保节点只能创建对应于当前正在该节点上运行的真实
760
+ Pod 的 PodCertificateRequest。
761
+
762
+ 创建后,PodCertificateRequest 的 `spec` 是不可变的。
763
+
764
+ <!--
765
+ Unlike CSRs, PodCertificateRequests do not have an
766
+ approval phase. Once the PodCertificateRequest is created, the signer's
767
+ controller directly decides to issue or deny the request. It also has the
768
+ option to mark the request as failed, if it encountered a permanent error when
769
+ attempting to issue the request.
770
+
771
+ To take any of these actions, the signing controller needs to have the
772
+ appropriate permissions on both the PodCertificateRequest type, as well as on
773
+ the signer name :
774
+ * Verbs: **update**, group: `certificates.k8s.io`, resource:
775
+ ` podcertificaterequests/status`
776
+ * Verbs: **sign**, group: `certificates.k8s.io`, resource: `signers`,
777
+ resourceName : ` <signerNameDomain>/<signerNamePath>` or `<signerNameDomain>/*`
778
+ -->
779
+ 与 CSR 不同,PodCertificateRequests 没有批准阶段。一旦创建了 PodCertificateRequest,
780
+ 签名者的控制器会直接决定是发放还是拒绝请求。它还有权在尝试发放请求时遇到永久性错误的情况下,将请求标记为失败。
781
+
782
+ 要执行这些操作之一,签名控制器需要具有针对给定 PodCertificateRequest 类型以及签名者的适当权限:
783
+
784
+ * 动词:**update**,组:`certificates.k8s.io`,资源:`podcertificaterequests/status`
785
+ * 动词:**sign**,组:`certificates.k8s.io`,资源:`signers`,
786
+ 资源名称:`<signerNameDomain>/<signerNamePath>` 或 `<signerNameDomain>/*`
787
+
788
+ <!--
789
+ The signing controller is free to consider other information beyond what's
790
+ contained in the request, but it can rely on the information in the request to
791
+ be accurate. For example, the signing controller might load the Pod and read
792
+ annotations set on it, or perform a SubjectAccessReview on the ServiceAccount.
793
+ -->
794
+ 签名控制器可以考察除请求中包含的信息之外的其他信息,但它可以相信请求中的信息是准确的。
795
+ 例如,签名控制器可能会加载 Pod 并读取 Pod 上设置的注解,或者对 ServiceAccount
796
+ 执行 SubjectAccessReview。
797
+
798
+ <!--
799
+ To issue a certificate in response to a request, the signing controller :
800
+ * Adds an `Issued` condition to `status.conditions`.
801
+ * Puts the issued certificate in `status.certificateChain`
802
+ * Puts the `NotBefore` and `NotAfter` fields of the certificate in the
803
+ ` status.notBefore` and `status.notAfter` fields — these fields are
804
+ denormalized into the Kubernetes API in order to aid debugging
805
+ * Suggests a time to begin attempting to refresh the certificate using
806
+ ` status.beginRefreshAt` .
807
+ -->
808
+ 为了响应请求颁发证书,签署控制器会:
809
+
810
+ * 在 `status.conditions` 中添加一个 `Issued` 状况。
811
+ * 将颁发的证书放入 `status.certificateChain`。
812
+ * 将证书的 `NotBefore` 和 `NotAfter` 字段分别放入 `status.notBefore` 和
813
+ ` status.notAfter` 字段 — 这些字段被反规范化到 Kubernetes API 中,以帮助调试。
814
+ * 建议使用 `status.beginRefreshAt` 开始尝试刷新证书的时间。
815
+
816
+ <!--
817
+ To deny a request, the signing controller adds a "Denied" condition to
818
+ ` status.conditions[]` .
819
+
820
+ To mark a request failed, the signing controller adds a "Failed" condition to
821
+ ` status.conditions[]` .
822
+
823
+ All of these conditions are mutually-exclusive, and must have status "True". No
824
+ other condition types are permitted on PodCertificateRequests. In addition,
825
+ once any of these conditions are set, the `status` field becomes immutable.
826
+ -->
827
+ 为了拒绝请求,签署控制器会在 `status.conditions[]` 中添加一个 "Denied" 状况。
828
+
829
+ 为了标记请求失败,签署控制器会在 `status.conditions[]` 中添加一个 "Failed" 状况。
830
+
831
+ 所有这些状况都是互斥的,且必须具有 “True” 状态。不允许在 PodCertificateRequest
832
+ 上设置其他类型的状况信息。此外,一旦设置了所列的任一状况,`status` 字段将变为不可变。
833
+
834
+ <!--
835
+ Like all conditions, the `status.conditions[].reason` field is meant to contain
836
+ a machine-readable code describing the condition in TitleCase. The
837
+ ` status.conditions[].message` field is meant for a free-form explanation for
838
+ human consumption.
839
+
840
+ To ensure that terminal PodCertificateRequests do not build up in the cluster, a
841
+ ` kube-controller-manager` controller deletes all PodCertificateRequests older
842
+ than 15 minutes. All certificate issuance flows are expected to complete within
843
+ this 15-minute limit.
844
+ -->
845
+ 像所有其他状况一样,`status.conditions[].reason` 字段用于包含描述状况的机器可读代码,
846
+ 使用 TitleCase 表示。`status.conditions[].message` 字段用于包含供人阅读的自由格式解释。
847
+
848
+ 为了确保终端 PodCertificateRequests 不会在集群中积累,`kube-controller-manager`
849
+ 控制器会删除所有超过 15 分钟的 PodCertificateRequests。
850
+ 所有证书颁发流程都应在这一 15 分钟限制内完成。
851
+
687
852
<!--
688
853
# # Cluster trust bundles {#cluster-trust-bundles}
689
854
-->
0 commit comments