Skip to content

Commit 8ba16fc

Browse files
committed
Refactor Certificates Documentation
1 parent cb4b423 commit 8ba16fc

File tree

7 files changed

+867
-483
lines changed

7 files changed

+867
-483
lines changed

content/en/docs/concepts/security/certificates.md

Lines changed: 578 additions & 0 deletions
Large diffs are not rendered by default.

content/en/docs/concepts/storage/projected-volumes.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Currently, the following types of volume sources can be projected:
2525
* [`configMap`](/docs/concepts/storage/volumes/#configmap)
2626
* [`serviceAccountToken`](#serviceaccounttoken)
2727
* [`clusterTrustBundle`](#clustertrustbundle)
28+
* [`podCertificate`](#podcertificate)
2829

2930
All sources are required to be in the same namespace as the Pod. For more details,
3031
see the [all-in-one volume](https://git.k8s.io/design-proposals-archive/node/all-in-one-volume.md) design document.
@@ -96,6 +97,60 @@ By default, the kubelet will prevent the pod from starting if the named ClusterT
9697

9798
{{% code_sample file="pods/storage/projected-clustertrustbundle.yaml" %}}
9899

100+
## podCertificate projected volumes {#podcertificate}
101+
102+
{{< feature-state feature_gate_name="PodCertificateRequest" >}}
103+
104+
{{< note >}}
105+
In Kubernetes {{< skew currentVersion >}}, you must enable support for Pod
106+
Certificates using the `PodCertificateRequest` [feature
107+
gate](/docs/reference/command-line-tools-reference/feature-gates/) and the
108+
`--runtime-config=certificates.k8s.io/v1alpha1/podcertificaterequests=true`
109+
kube-apiserver flag.
110+
{{< /note >}}
111+
112+
The `podCertificate` projected volumes source securely provisions a private key
113+
and X.509 certificate chain for pod to use as client or server credentials.
114+
Kubelet will then handle refreshing the private key and certificate chain when
115+
they get close to expiration. The application just has to make sure that it
116+
reloads the file promptly when it changes, with a mechanism like `inotify` or
117+
polling.
118+
119+
Each `podCertificate` projection supports the following configuration fields:
120+
* `signerName`: The
121+
[signer](/docs/reference/access-authn-authz/certificate-signing-requests#signers)
122+
you want to issue the certificate. Note that signers may have their own
123+
access requirements, and may refuse to issue certificates to your pod.
124+
* `keyType`: The type of private key that should be generated. Valid values are
125+
`ED25519`, `ECDSAP256`, `ECDSAP384`, `ECDSAP521`, `RSA3072`, and `RSA4096`.
126+
* `maxExpirationSeconds`: The maximum lifetime you will accept for the
127+
certificate issued to the pod. If not set, will be defaulted to `86400` (24
128+
hours). Must be at least `3600` (1 hour), and at most `7862400` (91 days).
129+
The signer is allowed to issue a certificate with a lifetime shorter than what
130+
you've specified.
131+
* `credentialBundlePath`: Relative path within the projection where the
132+
credential bundle should be written. The credential bundle is a PEM-formatted
133+
file, where the first block is a "PRIVATE KEY" block that contains a
134+
PKCS#8-serialized private key, and the remaining blocks are "CERTIFICATE"
135+
blocks that comprise the certificate chain (leaf certificate and any
136+
intermediates).
137+
* `keyPath` and `certificateChainPath`: Separate paths where Kubelet should
138+
write *just* the private key or certificate chain.
139+
140+
{{< note >}}
141+
142+
Most applications should prefer using `credentialBundlePath` unless they need
143+
the key and certificates in separate files for compatibility reasons. Kubelet
144+
uses an atomic writing strategy based on symlinks to make sure that when you
145+
open the files it projects, you read either the old content or the new content.
146+
However, if you read the key and certificate chain from separate files, Kubelet
147+
may rotate the credentials after your first read and before your second read,
148+
resulting in your application loading a mismatched key and certificate.
149+
150+
{{< /note >}}
151+
152+
{{% code_sample file="pods/storage/projected-podcertificate.yaml" %}}
153+
99154
## SecurityContext interactions
100155

101156
The [proposal](https://git.k8s.io/enhancements/keps/sig-storage/2451-service-account-token-volumes#proposal) for file permission handling in projected service account volume enhancement introduced the projected files having the correct owner permissions set.

0 commit comments

Comments
 (0)