Document examples of downward API exposing container resources via

environment variables and volumes.
This commit is contained in:
Avesh Agarwal
2016-06-01 16:15:50 -04:00
parent ee396b4439
commit d45e0ce4df
5 changed files with 194 additions and 11 deletions
+24 -3
View File
@@ -1,5 +1,5 @@
Following this example, you will create a pod with a container that consumes the pod's name and
namespace using the [downward API](http://kubernetes.io/docs/user-guide/downward-api/).
Following these examples, you will create a pod with a container that consumes the pod's name,
namespace, and resource values using the [downward API](http://kubernetes.io/docs/user-guide/downward-api/).
## Step Zero: Prerequisites
@@ -29,4 +29,25 @@ $ kubectl logs dapi-test-pod | grep POD_
2015-04-30T20:22:18.568024817Z MY_POD_NAME=dapi-test-pod
2015-04-30T20:22:18.568087688Z MY_POD_NAMESPACE=default
2015-04-30T20:22:18.568092435Z MY_POD_IP=10.0.1.6
```
```
## Example of environment variables with container resources
Use the [`dapi-container-resources.yaml`](dapi-container-resources.yaml) file to create a Pod
with a container that consumes the downward API exposing the container's resources.
```shell
$ kubectl create -f docs/user-guide/downward-api/dapi-container-resources.yaml
```
### Examine the logs
Grep through the pod logs to see that the pod was injected with the correct values:
```shell
$ kubectl logs dapi-test-pod | grep MY_
MY_MEM_LIMIT=67108864
MY_CPU_LIMIT=1
MY_MEM_REQUEST=33554432
MY_CPU_REQUEST=1
```