-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[WIP] Rewrite Secret concept #24169
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[WIP] Rewrite Secret concept #24169
Conversation
✔️ Deploy Preview for kubernetes-io-main-staging ready! 🔨 Explore the source changes: 22c5b45 🔍 Inspect the deploy log: https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/60cd31d0d668d8a572044cac 😎 Browse the preview: https://deploy-preview-24169--kubernetes-io-main-staging.netlify.app |
Related to #23825 |
or encryption keys. | ||
|
||
To use that confidential data, a Pod needs to reference the Secret in a container | ||
definition. |
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.
This is inaccurate. Not all Secret are referenced in container definition. Right?
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.
Good point, this could be misleading.
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.
nit: You could write,
However, Secrets are ...
instead of
However, Secret objects
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.
@sftim, Have you resolved the question about lines 40-41?
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.
Yep, I think this is addressed.
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.
OK
it becomes available, you can mark the Secret as optional in the Pod specification. | ||
None of the Pod's containers will start until all non-optional Secrets are | ||
available. | ||
{{< /caution >}} |
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.
Please remove the 'caution' shortcode?
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.
None of the Pod's containers will start until all non-optional Secrets are available.
Please revise this "none ... until all non-optional ..." sentence.
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.
I could switch this from a caution to a note.
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.
This is a bit of a mashup of note and warning.
You are indicating to the reader that Secrets can be declared "optional" in the Pod configuration.
Then secondly, you warn that a Pod's containers are prevented from starting until the "required" or "non-optional" Secrets are ready. Could the first sentence move out of the callout?
### Using Secrets as files from a Pod | ||
{{< caution >}} | ||
Secret volume sources are validated to ensure that the specified object | ||
reference actually points to an object of type Secret. Therefore, a secret |
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.
reference actually points to an object of type Secret. Therefore, a secret | |
reference actually points to an object of type Secret. Therefore, a Secret |
needs to be created before any Pods that depend on it. | ||
|
||
If the secret cannot be fetched because it does not exist or | ||
because of a temporary lack of connection to the API server, the kubelet |
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.
we use 'because of' for positive conditions and 'due to' for negative ones?
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.
I'm not sure that's true, but varying the wording makes the text more pleasing anyway. I'll reword.
reference actually points to an object of type Secret. Therefore, a secret | ||
needs to be created before any Pods that depend on it. | ||
|
||
If the secret cannot be fetched because it does not exist or |
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.
If the secret cannot be fetched because it does not exist or | |
If the Secret cannot be fetched because it does not exist or |
available. | ||
{{< /caution >}} | ||
|
||
#### Using Secrets as files from a Pod |
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.
In general, I'd suggest we move these contents (with examples) about using secret into the tasks section. We already have a lot of duplicated contents on this topic.
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.
I hope that can wait for a follow-up PR as I'd love to get these changes merged.
Secret volume sources are validated to ensure that the specified object | ||
reference actually points to an object of type Secret. Therefore, a secret | ||
needs to be created before any Pods that depend on it. | ||
{{< /note >}} |
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.
please remove the 'note' shortcode unless we have a good reason to do so.
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.
I think this is a detail readers need to know. Is it not?
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.
Everything documented here is something readers need to know, but that doesn't mean we need to wrap them into a note.
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.
Fair enough!
|
||
#### Projection of Secret keys to specific paths | ||
##### Projection of Secret keys to specific paths |
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.
I don't think we are encouraged to use FIVE '#' as subsections. If we do, we have a problem with content organization.
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.
I agree. When the content gets to heading level 5, the readability of the content decreases. That said, I need to look at the rendered page again.
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.
we have a problem with content organization
This, I think. However I think this addition helps get this change mergeable. We can track further work to improve the updated page.
* `username` secret is stored under `/etc/foo/my-group/my-username` file instead of `/etc/foo/username`. | ||
* `password` secret is not projected. | ||
* the `username` key from `mysecret` is available to the container at the path | ||
`/etc/foo/my-group/my-username` file instead of at `/etc/foo/username`. |
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.
at the path
....
file
This reads strange.
{{< note >}} | ||
If you list keys explicitly, then all listed keys must exist in the corresponding Secret. | ||
Otherwise, the volume is not created. | ||
{{< /note >}} |
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.
Please avoid flooding the page with 'note' shortcode. We can treat all contents as noteworthy or else we won't document them.
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.
I wonder if the answer here is a new kind of callout with a more subtle highlight color (eg gray).
I want to call this out but only a little bit.
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.
Seems like you could make it a note or not.
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.
Callouts are useful for unexpected warnings, subtle hints, ...
Since shortcodes are creating quite some issues for localization, I'd suggest we use them carefully.
Then, the secret will be mounted on `/etc/foo` and all the files created by the | ||
secret volume mount will have permission `0400`. | ||
|
||
Note that the JSON spec doesn't support octal notation, so use the value 256 for | ||
0400 permissions. If you use YAML instead of JSON for the Pod, you can use octal | ||
notation to specify permissions in a more natural way. | ||
|
||
Note if you `kubectl exec` into the Pod, you need to follow the symlink to find | ||
the expected file mode. For example, | ||
|
||
Check the secrets file mode on the pod. | ||
``` | ||
kubectl exec mypod -it sh | ||
|
||
cd /etc/foo | ||
ls -l | ||
``` | ||
The secret is mounted on `/etc/foo`; all the files created by the | ||
secret volume mount have permission `0400`. |
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.
Where are these content now?
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.
Gone. This page is about Secrets and is quite long. I propose not telling readers here about how to represent POSIX file modes in JSON, because it's several steps removed from answering the question “In Kubernetes, what is a Secret?”
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.
I agree this is not the right place to mention POSIX file modes. Somewhere we still need to call this out because it is something that may get people trapped.
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.
Could that be on a (future) task page? I could log an issue to to that migration etc.
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.
Logging an issue sounds an option, but the rule of thumb here is do not aimlessly drop useful information.
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.
I've revised the wording to include the cautionary message, less verbosely.
secret. | ||
Kubernetes automatically creates Secrets that contain credentials for | ||
accessing the Kubernetes API. By default, the Kubernetes control plane automatically | ||
modifies newly-added Pods to use this type of Secret. |
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.
nit: double use of "automatically". Could write:
By default, the Kubernetes control plane modifies newly-added Pods to use this type of Secret.
Which type of Secret?
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.
I think "this type of Secret" means service account Secrets.
@@ -314,18 +301,20 @@ The output is similar to: | |||
1f2d1e2e67df | |||
``` | |||
|
|||
The program in a container is responsible for reading the secrets from the | |||
files. | |||
The program in a container is responsible for reading the secret data from these |
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.
Wording: "The program" to "The application"? There are a few places in this page where "program" is used in a sentence.
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.
Is “program” wrong? It makes sense to me.
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.
The program in a container ...
I'd have to reread again. Which program?
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.
A running container always has one main process (PID 1 on POSIX), and has 0 or more other processes (typically zero). Each process is running program code.
BTW @mikedanese would you like to nominate additional reviewer(s) for this concept? |
79418fd
to
c8afd49
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mbevc1 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
c8afd49
to
22c5b45
Compare
Yep. I think it needs a rewrite. I'm open to persuasion that the existing page is already of good enough quality, but I think it would take a lot to convince me. Rather than reviewing as a set of changes, I recommend comparing the preview to the current page. If the new page is better than the existing one, then I recommend merging it. If not, I'd like feedback on the new page (as if we were adding a new document), so that I can understand how to improve the rewritten page. I did not excise or migrate https://kubernetes.io/docs/concepts/configuration/secret/#use-cases. I can do, but I think that this PR is large enough without also touching that section. @tengqm mentioned localization. /retitle Rewrite Secret concept |
/hold |
Hi. I will read the changes again, looking at the organization of the concepts. |
Thanks for all reviews so far! |
@sftim: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@sftim As of now, K8s v1.21 and v1.22 are released! 😊 |
My plan for this PR is to break into into smaller PRs (such as #27716) that are easier to review. There is more to do on that front. |
/retitle [WIP] Rewrite Secret concept |
@sftim this is k/website's oldest open PR. Shall we close it (I would like to see the content merge) or do you need help getting it out of WIP? |
I already split out #27716 and do intend to split other PRs out of this one. I'd like to leave this (as WIP) for a bit longer, hoping to allocate time to the other changes that this larger PR wanted to make. |
If anyone else wants to help with that splitting up, I shan't complain. |
I'll close this and work on new PRs. |
/close |
@sftim: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
(because that level of detail belongs in a task page, not a concept page)
Preview
Note to reviewers:
{{< codenew >}}
blocks; it's size/XL as it is!/language en
/sig apps
/sig security
Fixes: #21435