Skip to content

Commit

Permalink
document pod downwardAPI fieldRef & resourceFiledRef values (#14321)
Browse files Browse the repository at this point in the history
* document pod downwardAPI fieldRef & resourceRef values of en version

* document pod downwardAPI fieldRef & resourceRef values of zh version

* typo correction
  • Loading branch information
yuchengwu authored and k8s-ci-robot committed May 21, 2019
1 parent 8ab64f7 commit 6c3d270
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,27 +199,32 @@ The following information is available to containers through environment
variables and `downwardAPI` volumes:

* Information available via `fieldRef`:
* `spec.nodeName` - the node’s name
* `status.hostIP` - the node's IP
* `metadata.name` - the pod’s name
* `metadata.namespace` - the pod’s namespace
* `status.podIP` - the pod’s IP address
* `spec.serviceAccountName` - the pod’s service account name
* `metadata.uid` - the pod’s UID
* `metadata.uid` - the pod’s UID, available since v1.8.0-alpha.2
* `metadata.labels['<KEY>']` - the value of the pod’s label `<KEY>` (for example, `metadata.labels['mylabel']`); available in Kubernetes 1.9+
* `metadata.annotations['<KEY>']` - the value of the pod’s annotation `<KEY>` (for example, `metadata.annotations['myannotation']`); available in Kubernetes 1.9+
* Information available via `resourceFieldRef`:
* A Container’s CPU limit
* A Container’s CPU request
* A Container’s memory limit
* A Container’s memory request
* A Container’s ephemeral-storage limit, available since v1.8.0-beta.0
* A Container’s ephemeral-storage request, available since v1.8.0-beta.0

In addition, the following information is available through
`downwardAPI` volume `fieldRef`:

* `metadata.labels` - all of the pod’s labels, formatted as `label-key="escaped-label-value"` with one label per line
* `metadata.annotations` - all of the pod’s annotations, formatted as `annotation-key="escaped-annotation-value"` with one annotation per line

The following information is available through environment variables:

* `status.podIP` - the pod’s IP address
* `spec.serviceAccountName` - the pod’s service account name, available since v1.4.0-alpha.3
* `spec.nodeName` - the node’s 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,34 @@ kubectl exec -it kubernetes-downwardapi-volume-example-2 -- sh

下面这些信息可以通过环境变量和DownwardAPIVolumeFiles提供给容器:

* 节点名称
* 节点IP
* Pod名称
* Pod名字空间
* Pod IP地址
* Pod服务帐号名称
* Pod的UID
* 容器的CPU约束
* 容器的CPU请求值
* 容器的内存约束
* 容器的内存请求值

此外,以下信息可通过DownwardAPIVolumeFiles获得:

* Pod的标签
* Pod的注释
能通过`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+

能通过`resourceFieldRef`获得的:
* 容器的CPU约束值
* 容器的CPU请求值
* 容器的内存约束值
* 容器的内存请求值
* 容器的临时存储约束值, 版本要求 v1.8.0-beta.0
* 容器的临时存储请求值, 版本要求 v1.8.0-beta.0

此外,以下信息可通过DownwardAPIVolumeFiles从`fieldRef`获得:

* `metadata.labels` - all of the pod’s labels, formatted as `label-key="escaped-label-value"` with one label per line
* `metadata.annotations` - all of the pod’s 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默认为节点可分配值。
Expand Down

0 comments on commit 6c3d270

Please sign in to comment.