From 956dcf8cd6a2eee39c6637d6607a0c10ece7d971 Mon Sep 17 00:00:00 2001 From: Brandon Cole Date: Wed, 7 Dec 2016 20:53:56 -0500 Subject: [PATCH] Updating downward-api/index.md for spec.nodeName There are a couple awesome enhancements that would benefit from being documented here: 1. `spec.nodeName` for obtaining the host name 2. `spec.serviceAccountName` for obtaining the name of the service account the pod is running under Right now these enhancements are documented only in a couple of issues and pull requests: 1. https://github.com/kubernetes/kubernetes/pull/27880 2. https://github.com/kubernetes/kubernetes/issues/24657 3. https://github.com/kubernetes/kubernetes/issues/21317 I have verified the functionality in the latest codebase: 1. https://github.com/kubernetes/kubernetes/blob/master/pkg/api/v1/conversion.go#L200 Also updating downward-api/dapi-pod.yaml to add a concrete example. --- docs/user-guide/downward-api/dapi-pod.yaml | 8 ++++++++ docs/user-guide/downward-api/index.md | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/user-guide/downward-api/dapi-pod.yaml b/docs/user-guide/downward-api/dapi-pod.yaml index 7d688aa0e9..5de0260bfc 100644 --- a/docs/user-guide/downward-api/dapi-pod.yaml +++ b/docs/user-guide/downward-api/dapi-pod.yaml @@ -8,6 +8,10 @@ spec: image: gcr.io/google_containers/busybox command: [ "/bin/sh", "-c", "env" ] env: + - name: MY_NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName - name: MY_POD_NAME valueFrom: fieldRef: @@ -20,4 +24,8 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP + - name: MY_POD_SERVICE_ACCOUNT + valueFrom: + fieldRef: + fieldPath: spec.serviceAccountName restartPolicy: Never diff --git a/docs/user-guide/downward-api/index.md b/docs/user-guide/downward-api/index.md index 00cef8f43e..33b2b06c49 100644 --- a/docs/user-guide/downward-api/index.md +++ b/docs/user-guide/downward-api/index.md @@ -22,9 +22,11 @@ the Pod's name, for example, and inject it into this well-known variable. The following information is available to a `Pod` through the downward API: -* The pod's name +* The node's name +*   The pod's name * The pod's namespace * The pod's IP +* The pod's service account name * A container's cpu limit * A container's cpu request * A container's memory limit @@ -101,10 +103,12 @@ In future, it will be possible to specify an output format option. Downward API volumes can expose: +* The node's name * The pod's name * The pod's namespace * The pod's labels * The pod's annotations +* The pod's service account name * A container's cpu limit * A container's cpu request * A container's memory limit