anchor.diff:  ----
   ====
   
  -. Check the container's logs:
  +. Check the container's logs for the `*MY_POD_NAME*` and `*MY_POD_NAMESPACE*`
  +values:
   +
   ====
   ----
   $ oc logs -p dapi-env-test-pod
   ----
   ====
  -+
  -You should see `MY_POD_NAME` and `MY_POD_NAMESPACE` in the logs.
  -
  -[[dapi-using-volume-plugin]]
  -== Using the Volume Plug-in
  +
  +[[dapi-values-using-volume-plugin]]
  +=== Using the Volume Plug-in
   
   Another mechanism for consuming the downward API is using a volume plug-in. The
   downward API volume plug-in creates a volume with configured fields projected
  
positive.code: The `*apiVersion*` field, if not specified, defaults to the API version of the
  enclosing pod template.
  
  In the future, more information, such as resource limits for pods and
  information about services, will be available using the downward API.
  
  [[dapi-using-environment-variables]]
  == Using Environment Variables
  
  One mechanism for consuming the downward API is using a container's environment
  variables. The `*EnvVar*` type's `*valueFrom*` field (of type `*EnvVarSource*`)
  
negative.code: kubernetes.io/config.source=api
  ----
  ====
  
  [[dapi-consuming-container-resources]]
  == Consuming Container Resources Using the Downward API
  
  When creating pods, you can use the downward API to inject information about
  computing resource requests and limits so that image and application authors can
  correctly create an image for specific environments.
  
  You can do this using both the xref:dapi-using-environment-variables[environment
  variable] and xref:dapi-using-volume-plugin[volume plug-in] methods.
  
  [[dapi-resources-environment-variables]]
  === Using Environment Variables
  
  . When creating a pod configuration, specify environment variables that
  correspond to the contents of the `*resources*` field in the `*spec.container*`
  field:
  +
  ====
  ----
  ...
  spec:
    containers:
      - name: test-container
        image: gcr.io/google_containers/busybox:1.24
        command: [ "/bin/sh", "-c", "env" ]
        resources:
          requests:
            memory: "32Mi"
            cpu: "125m"
          limits:
            memory: "64Mi"
            cpu: "250m"
        env:
          - name: MY_CPU_REQUEST
            valueFrom:
              resourceFieldRef:
                resource: requests.cpu
          - name: MY_CPU_LIMIT
            valueFrom:
              resourceFieldRef:
                resource: limits.cpu
          - name: MY_MEM_REQUEST
            valueFrom:
              resourceFieldRef:
                resource: requests.memory
          - name: MY_MEM_LIMIT
            valueFrom:
              resourceFieldRef:
                resource: limits.memory
  ...
  ----
  ====
  +
  If the resource limits are not included in the container configuration, the
  downward API defaults to the node's CPU and memory allocatable values.
  
  . Create the pod from the `*_pod.json_*` file:
  +
  ====
  ----
  $ oc create -f pod.json
  ----
  ====
  
  
  [[dapi-resources-volume-plugin]]
  === Using the Volume Plug-in
  
  . When creating a pod configuration, use the `*spec.volumes.downwardAPI.items*`
  field to describe the desired resources that correspond to the
  `*spec.resources*` field:
  +
  ====
  ----
  ....
  spec:
    containers:
      - name: client-container
        image: gcr.io/google_containers/busybox:1.24
        command: ["sh", "-c", "while true; do echo; if [[ -e /etc/cpu_limit ]]; then cat /etc/cpu_limit; fi; if [[ -e /etc/cpu_request ]]; then cat /etc/cpu_request; fi; if [[ -e /etc/mem_limit ]]; then cat /etc/mem_limit; fi; if [[ -e /etc/mem_request ]]; then cat /etc/mem_request; fi; sleep 5; done"]
        resources:
          requests:
            memory: "32Mi"
            cpu: "125m"
          limits:
            memory: "64Mi"
            cpu: "250m"
        volumeMounts:
          - name: podinfo
            mountPath: /etc
            readOnly: false
    volumes:
      - name: podinfo
        downwardAPI:
          items:
            - path: "cpu_limit"
              resourceFieldRef:
                containerName: client-container
                resource: limits.cpu
            - path: "cpu_request"
              resourceFieldRef:
                containerName: client-container
                resource: requests.cpu
            - path: "mem_limit"
              resourceFieldRef:
                containerName: client-container
                resource: limits.memory
            - path: "mem_request"
              resourceFieldRef:
                containerName: client-container
                resource: requests.memory
  ....
  ----
  ====
  +
  If the resource limits are not included in the container configuration, the
  downward API defaults to the node's CPU and memory allocatable values.
  
  . Create the pod from the `*_volume-pod.json_*` file:
  +
  ====
  ----
  $ oc create -f volume-pod.json
  ----
  ====
  
  
  