document pod downwardAPI fieldRef & resourceFiledRef values (#14321)

* document pod downwardAPI fieldRef & resourceRef values of en version

* document pod downwardAPI fieldRef & resourceRef values of zh version

* typo correction
This commit is contained in:
Yucheng Wu 2019-05-21 15:54:40 +08:00 committed by Kubernetes Prow Robot
parent 8ab64f7e07
commit 6c3d270176
2 changed files with 36 additions and 19 deletions

View File

@ -199,13 +199,9 @@ The following information is available to containers through environment
variables and `downwardAPI` volumes:
* Information available via `fieldRef`:
* `spec.nodeName` - the nodes name
* `status.hostIP` - the node's IP
* `metadata.name` - the pods name
* `metadata.namespace` - the pods namespace
* `status.podIP` - the pods IP address
* `spec.serviceAccountName` - the pods service account name
* `metadata.uid` - the pods UID
* `metadata.uid` - the pods UID, available since v1.8.0-alpha.2
* `metadata.labels['<KEY>']` - the value of the pods label `<KEY>` (for example, `metadata.labels['mylabel']`); available in Kubernetes 1.9+
* `metadata.annotations['<KEY>']` - the value of the pods annotation `<KEY>` (for example, `metadata.annotations['myannotation']`); available in Kubernetes 1.9+
* Information available via `resourceFieldRef`:
@ -213,6 +209,8 @@ variables and `downwardAPI` volumes:
* A Containers CPU request
* A Containers memory limit
* A Containers memory request
* A Containers ephemeral-storage limit, available since v1.8.0-beta.0
* A Containers ephemeral-storage request, available since v1.8.0-beta.0
In addition, the following information is available through
`downwardAPI` volume `fieldRef`:
@ -220,6 +218,13 @@ In addition, the following information is available through
* `metadata.labels` - all of the pods labels, formatted as `label-key="escaped-label-value"` with one label per line
* `metadata.annotations` - all of the pods annotations, formatted as `annotation-key="escaped-annotation-value"` with one annotation per line
The following information is available through environment variables:
* `status.podIP` - the pods IP address
* `spec.serviceAccountName` - the pods service account name, available since v1.4.0-alpha.3
* `spec.nodeName` - the nodes name, available since v1.4.0-alpha.3
* `status.hostIP` - the node's IP, available since v1.7.0-alpha.1
{{< note >}}
If CPU and memory limits are not specified for a Container, the
Downward API defaults to the node allocatable value for CPU and memory.

View File

@ -169,22 +169,34 @@ kubectl exec -it kubernetes-downwardapi-volume-example-2 -- sh
下面这些信息可以通过环境变量和DownwardAPIVolumeFiles提供给容器
* 节点名称
* 节点IP
* Pod名称
* Pod名字空间
* Pod IP地址
* Pod服务帐号名称
* Pod的UID
* 容器的CPU约束
* 容器的CPU请求值
* 容器的内存约束
* 容器的内存请求值
能通过`fieldRef`获得的:
* `metadata.name` - Pod名称
* `metadata.namespace` - Pod名字空间
* `metadata.uid` - Pod的UID, 版本要求 v1.8.0-alpha.2
* `metadata.labels['<KEY>']` - 单个 pod 标签值 `<KEY>` (例如, `metadata.labels['mylabel']`); 版本要求 Kubernetes 1.9+
* `metadata.annotations['<KEY>']` - 单个 pod 的标注值 `<KEY>` (例如, `metadata.annotations['myannotation']`); 版本要求 Kubernetes 1.9+
此外以下信息可通过DownwardAPIVolumeFiles获得
能通过`resourceFieldRef`获得的:
* 容器的CPU约束值
* 容器的CPU请求值
* 容器的内存约束值
* 容器的内存请求值
* 容器的临时存储约束值, 版本要求 v1.8.0-beta.0
* 容器的临时存储请求值, 版本要求 v1.8.0-beta.0
* Pod的标签
* Pod的注释
此外以下信息可通过DownwardAPIVolumeFiles从`fieldRef`获得:
* `metadata.labels` - all of the pods labels, formatted as `label-key="escaped-label-value"` with one label per line
* `metadata.annotations` - all of the pods annotations, formatted as `annotation-key="escaped-annotation-value"` with one annotation per line
* `metadata.labels` - 所有Pod的标签以`label-key="escaped-label-value"`格式显示每行显示一个label
* `metadata.annotations` - Pod的注释以`annotation-key="escaped-annotation-value"`格式显示,每行显示一个标签
以下信息可通过环境变量从`fieldRef`获得:
* `status.podIP` - 节点IP
* `spec.serviceAccountName` - Pod服务帐号名称, 版本要求 v1.4.0-alpha.3
* `spec.nodeName` - 节点名称, 版本要求 v1.4.0-alpha.3
* `status.hostIP` - 节点IP, 版本要求 v1.7.0-alpha.1
{{< note >}}
如果容器未指定CPU和memory limits则Downward API默认为节点可分配值。