-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Refactor Certificates Documentation #51487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9d88f2d
c807d9c
d3b9281
2b5803b
78dc078
c900a02
74b7cab
6b081dd
d60ae4d
74ef2a1
e5435b0
cb4b423
8ba16fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,7 @@ Currently, the following types of volume sources can be projected: | |||||||||||||||||||||||
| * [`configMap`](/docs/concepts/storage/volumes/#configmap) | ||||||||||||||||||||||||
| * [`serviceAccountToken`](#serviceaccounttoken) | ||||||||||||||||||||||||
| * [`clusterTrustBundle`](#clustertrustbundle) | ||||||||||||||||||||||||
| * [`podCertificate`](#podcertificate) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| All sources are required to be in the same namespace as the Pod. For more details, | ||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| {{% code_sample file="pods/storage/projected-clustertrustbundle.yaml" %}} | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## podCertificate projected volumes {#podcertificate} | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| {{< feature-state feature_gate_name="PodCertificateRequest" >}} | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| {{< note >}} | ||||||||||||||||||||||||
| In Kubernetes {{< skew currentVersion >}}, you must enable support for Pod | ||||||||||||||||||||||||
| Certificates using the `PodCertificateRequest` [feature | ||||||||||||||||||||||||
| gate](/docs/reference/command-line-tools-reference/feature-gates/) and the | ||||||||||||||||||||||||
| `--runtime-config=certificates.k8s.io/v1alpha1/podcertificaterequests=true` | ||||||||||||||||||||||||
| kube-apiserver flag. | ||||||||||||||||||||||||
| {{< /note >}} | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| The `podCertificate` projected volumes source securely provisions a private key | ||||||||||||||||||||||||
| and X.509 certificate chain for pod to use as client or server credentials. | ||||||||||||||||||||||||
| Kubelet will then handle refreshing the private key and certificate chain when | ||||||||||||||||||||||||
| they get close to expiration. The application just has to make sure that it | ||||||||||||||||||||||||
ahmedtd marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit
Suggested change
|
||||||||||||||||||||||||
| reloads the file promptly when it changes, with a mechanism like `inotify` or | ||||||||||||||||||||||||
| polling. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Each `podCertificate` projection supports the following configuration fields: | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using a Markdown description list here. |
||||||||||||||||||||||||
| * `signerName`: The | ||||||||||||||||||||||||
| [signer](/docs/reference/access-authn-authz/certificate-signing-requests#signers) | ||||||||||||||||||||||||
| you want to issue the certificate. Note that signers may have their own | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||
| access requirements, and may refuse to issue certificates to your pod. | ||||||||||||||||||||||||
| * `keyType`: The type of private key that should be generated. Valid values are | ||||||||||||||||||||||||
| `ED25519`, `ECDSAP256`, `ECDSAP384`, `ECDSAP521`, `RSA3072`, and `RSA4096`. | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For beta, we should hyperlink to a reference doc that explains what each of these means. It's fairly obvious if you know X.509 and its evolution, but many people won't. It'll get even more complex if we support post-quantum / hybrid post-quantum keying. |
||||||||||||||||||||||||
| * `maxExpirationSeconds`: The maximum lifetime you will accept for the | ||||||||||||||||||||||||
| certificate issued to the pod. If not set, will be defaulted to `86400` (24 | ||||||||||||||||||||||||
| hours). Must be at least `3600` (1 hour), and at most `7862400` (91 days). | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mention that the reserved Kubernetes signers have a max of 1 day? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done (this was picked into the narrow-focused PR). |
||||||||||||||||||||||||
| The signer is allowed to issue a certificate with a lifetime shorter than what | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (nit) make "shorter" boldface edited There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think your comment is cut off |
||||||||||||||||||||||||
| you've specified. | ||||||||||||||||||||||||
| * `credentialBundlePath`: Relative path within the projection where the | ||||||||||||||||||||||||
| credential bundle should be written. The credential bundle is a PEM-formatted | ||||||||||||||||||||||||
ahmedtd marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||
| file, where the first block is a "PRIVATE KEY" block that contains a | ||||||||||||||||||||||||
| PKCS#8-serialized private key, and the remaining blocks are "CERTIFICATE" | ||||||||||||||||||||||||
| blocks that comprise the certificate chain (leaf certificate and any | ||||||||||||||||||||||||
| intermediates). | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's technically up to the signer, but we recommend that the certificates appear in leaf-to-root order. I can make this clear.
Comment on lines
+132
to
+136
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||
| * `keyPath` and `certificateChainPath`: Separate paths where Kubelet should | ||||||||||||||||||||||||
| write *just* the private key or certificate chain. | ||||||||||||||||||||||||
|
Comment on lines
+137
to
+138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| {{< note >}} | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Most applications should prefer using `credentialBundlePath` unless they need | ||||||||||||||||||||||||
| the key and certificates in separate files for compatibility reasons. Kubelet | ||||||||||||||||||||||||
| uses an atomic writing strategy based on symlinks to make sure that when you | ||||||||||||||||||||||||
| open the files it projects, you read either the old content or the new content. | ||||||||||||||||||||||||
| However, if you read the key and certificate chain from separate files, Kubelet | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (nit)
Suggested change
|
||||||||||||||||||||||||
| may rotate the credentials after your first read and before your second read, | ||||||||||||||||||||||||
| resulting in your application loading a mismatched key and certificate. | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| {{< /note >}} | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Introduce this code sample if feasible (explain what people are about to see). |
||||||||||||||||||||||||
| {{% code_sample file="pods/storage/projected-podcertificate.yaml" %}} | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## SecurityContext interactions | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.