-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Revise downward API documentation #32400
Revise downward API documentation #32400
Conversation
✅ Pull request preview available for checkingBuilt without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
title: Downward API | ||
content_type: concept | ||
description: > | ||
There are two ways to expose Pod and container fields to a running container: |
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 this context, I'd write the first 'container' as 'Container'.
A Container has fields, but a container doesn't.
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 the API, Container
with a capital C doesn't appear. We do see that in the Golang implementation, but not in the API (where it's actually containers
).
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.
They are API definitions, though not first class API resources.
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#container-v1-core
https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#Container
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 going to look for a way to word this so that people don't start trying to kubectl get container
and expect it to work, but also that readers end up clear on the two kinds of thing they can reference using the downward API.
|
||
### Fallback information for resource limits | ||
|
||
{{< 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.
I don't think it is a good practice to render a whole subsection into a note.
The Kubernetes downward API allows containers to consume information about themselves | ||
or their context in a Kubernetes cluster. Applications in containers can have | ||
access to that information, without the application needing to act as a client of | ||
the Kubernetes HTTP API. |
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 Kubernetes HTTP API. | |
the Kubernetes API. |
A `DownwardAPIVolumeFile` can expose Pod fields and Container fields. | ||
[`downwardAPI` volume](/docs/concepts/storage/volumes/#downwardapi), | ||
to expose information about itself to containers running in the Pod. | ||
A `downwardAPI` volume can expose Pod fields and container fields. |
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 `downwardAPI` volume can expose Pod fields and container fields. | |
A `downwardAPI` volume can expose Pod fields and Container fields. |
|
||
## {{% heading "prerequisites" %}} | ||
In Kubernetes, there are two ways to expose Pod and container fields to a running container: |
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 Kubernetes, there are two ways to expose Pod and container fields to a running container: | |
In Kubernetes, there are two ways to expose Pod and Container fields to a running container: |
The first element specifies that the value of the Pod's | ||
`metadata.labels` field should be stored in a file named `labels`. | ||
The second element specifies that the value of the Pod's `annotations` | ||
field should be stored in a file named `annotations`. | ||
|
||
{{< note >}} | ||
The fields in this example are Pod fields. They are not | ||
fields of the Container in the Pod. | ||
fields of the container in the 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.
fields of the container in the Pod. | |
fields of the Container in the Pod. |
or API server. | ||
* Read the [`spec`](/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodSpec) | ||
API definition for Pod. | ||
In Kubernetes, you use a `spec` to define the desired state of an object. |
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 line is useless, IMO.
* Read the [`spec`](/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodSpec) | ||
API definition for Pod. | ||
In Kubernetes, you use a `spec` to define the desired state of an object. | ||
* Read some [examples](/docs/concepts/workloads/pods/downward-api/#data-examples) of fields that you |
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.
No. They are not examples. The list contains all the fields that can be exposed.
@@ -155,18 +148,34 @@ The output shows the values of selected environment variables: | |||
67108864 | |||
``` | |||
|
|||
## Motivation for the Downward API |
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 this section belongs here, at the end of a task.
d8779d9
to
62fd82d
Compare
113d17f
to
85b6d85
Compare
How's this? I added text to explicitly explain that a Pod must include one Container. |
85b6d85
to
154ac66
Compare
@tengqm if you have time, please take another look here. |
/lgtm |
LGTM label has been added. Git tree hash: f2fb40db71465fb5ec16d461bf7ab90c517d6cf3
|
- add a glossary entry - add a concept page - revise other documentation in light of above changes
154ac66
to
7f3604a
Compare
Hi folks, this is ready for another review (I rebased). |
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 Nonblocking nits, otherwise LGTM
(based on the [node allocatable](/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable) | ||
calculation). |
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.
No parentheses needed
(based on the [node allocatable](/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable) | |
calculation). | |
based on the [node allocatable](/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable) | |
calculation. |
|
||
An example is an existing application that assumes a particular well-known | ||
environment variable holds a unique identifier. One possibility is to wrap the | ||
application, but that is tedious and error prone, and it violates the goal of low |
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.
Normally I am treasurer for life of the I Hate Hyphens club, but for the sake of easier localization--
application, but that is tedious and error prone, and it violates the goal of low | |
application, but that is tedious and error-prone, and it violates the goal of low |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: zacharysarah The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
LGTM label has been added. Git tree hash: e712e1299000b2685d87d695b396a9b1ff4b38cd
|
downwardAPI
volumesdownwardAPI
volumes/label refactor
/kind cleanup